mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-08 16:53:10 +00:00
Merge pull request #763 from status-im/go-waku-drop-in
This commit is contained in:
commit
9f52d2b49d
46
.github/workflows/ci.yml
vendored
46
.github/workflows/ci.yml
vendored
@ -97,6 +97,52 @@ jobs:
|
|||||||
name: nwaku-logs
|
name: nwaku-logs
|
||||||
path: log/
|
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: ./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 "${WAKU_SERVICE_NODE_DIR}"
|
||||||
|
"${WAKU_SERVICE_NODE_BIN}" --version
|
||||||
|
|
||||||
|
- 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:
|
release_next:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||||
|
|||||||
@ -64,7 +64,15 @@ export class DnsNodeDiscovery {
|
|||||||
this._errorTolerance,
|
this._errorTolerance,
|
||||||
() => this._search(domain, context)
|
() => 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;
|
return peers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -99,6 +99,7 @@ describe("Wait for remote peer", function () {
|
|||||||
relay: false,
|
relay: false,
|
||||||
lightpush: false,
|
lightpush: false,
|
||||||
filter: false,
|
filter: false,
|
||||||
|
persistMessages: true,
|
||||||
});
|
});
|
||||||
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
||||||
|
|
||||||
@ -125,6 +126,7 @@ describe("Wait for remote peer", function () {
|
|||||||
relay: false,
|
relay: false,
|
||||||
lightpush: false,
|
lightpush: false,
|
||||||
filter: false,
|
filter: false,
|
||||||
|
persistMessages: true,
|
||||||
});
|
});
|
||||||
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
const multiAddrWithId = await nwaku.getMultiaddrWithId();
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ describe("Waku Filter", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
this.timeout(10000);
|
this.timeout(15000);
|
||||||
nwaku = new Nwaku(makeLogFileName(this));
|
nwaku = new Nwaku(makeLogFileName(this));
|
||||||
await nwaku.start({ filter: true, lightpush: true });
|
await nwaku.start({ filter: true, lightpush: true });
|
||||||
waku = await createWaku({
|
waku = await createWaku({
|
||||||
@ -46,6 +46,10 @@ describe("Waku Filter", () => {
|
|||||||
expect(msg.payloadAsUtf8).to.eq(messageText);
|
expect(msg.payloadAsUtf8).to.eq(messageText);
|
||||||
};
|
};
|
||||||
await waku.filter.subscribe(callback, [TestContentTopic]);
|
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(
|
const message = await WakuMessage.fromUtf8String(
|
||||||
messageText,
|
messageText,
|
||||||
TestContentTopic
|
TestContentTopic
|
||||||
@ -66,6 +70,7 @@ describe("Waku Filter", () => {
|
|||||||
expect(msg.contentTopic).to.eq(TestContentTopic);
|
expect(msg.contentTopic).to.eq(TestContentTopic);
|
||||||
};
|
};
|
||||||
await waku.filter.subscribe(callback, [TestContentTopic]);
|
await waku.filter.subscribe(callback, [TestContentTopic]);
|
||||||
|
await delay(200);
|
||||||
await waku.lightPush.push(
|
await waku.lightPush.push(
|
||||||
await WakuMessage.fromUtf8String("Filtering works!", TestContentTopic)
|
await WakuMessage.fromUtf8String("Filtering works!", TestContentTopic)
|
||||||
);
|
);
|
||||||
@ -89,6 +94,7 @@ describe("Waku Filter", () => {
|
|||||||
const unsubscribe = await waku.filter.subscribe(callback, [
|
const unsubscribe = await waku.filter.subscribe(callback, [
|
||||||
TestContentTopic,
|
TestContentTopic,
|
||||||
]);
|
]);
|
||||||
|
await delay(200);
|
||||||
await waku.lightPush.push(
|
await waku.lightPush.push(
|
||||||
await WakuMessage.fromUtf8String(
|
await WakuMessage.fromUtf8String(
|
||||||
"This should be received",
|
"This should be received",
|
||||||
@ -97,6 +103,7 @@ describe("Waku Filter", () => {
|
|||||||
);
|
);
|
||||||
await delay(100);
|
await delay(100);
|
||||||
await unsubscribe();
|
await unsubscribe();
|
||||||
|
await delay(200);
|
||||||
await waku.lightPush.push(
|
await waku.lightPush.push(
|
||||||
await WakuMessage.fromUtf8String(
|
await WakuMessage.fromUtf8String(
|
||||||
"This should not be received",
|
"This should not be received",
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import { WakuMessage } from "../lib/waku_message";
|
|||||||
import * as proto from "../proto/message";
|
import * as proto from "../proto/message";
|
||||||
|
|
||||||
import { existsAsync, mkdirAsync, openAsync } from "./async_fs";
|
import { existsAsync, mkdirAsync, openAsync } from "./async_fs";
|
||||||
|
import { delay } from "./delay";
|
||||||
import waitForLine from "./log_file";
|
import waitForLine from "./log_file";
|
||||||
|
|
||||||
const dbg = debug("waku:nwaku");
|
const dbg = debug("waku:nwaku");
|
||||||
@ -181,6 +182,7 @@ export class Nwaku {
|
|||||||
|
|
||||||
dbg(`Waiting to see '${NODE_READY_LOG_LINE}' in nwaku logs`);
|
dbg(`Waiting to see '${NODE_READY_LOG_LINE}' in nwaku logs`);
|
||||||
await this.waitForLog(NODE_READY_LOG_LINE, 15000);
|
await this.waitForLog(NODE_READY_LOG_LINE, 15000);
|
||||||
|
if (process.env.CI) await delay(100);
|
||||||
dbg("nwaku node has been started");
|
dbg("nwaku node has been started");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,12 +251,19 @@ export class Nwaku {
|
|||||||
async getAsymmetricKeyPair(): Promise<KeyPair> {
|
async getAsymmetricKeyPair(): Promise<KeyPair> {
|
||||||
this.checkProcess();
|
this.checkProcess();
|
||||||
|
|
||||||
const { seckey, pubkey } = await this.rpcCall<{
|
const { privateKey, publicKey, seckey, pubkey } = await this.rpcCall<{
|
||||||
seckey: string;
|
seckey: string;
|
||||||
pubkey: string;
|
pubkey: string;
|
||||||
|
privateKey: string;
|
||||||
|
publicKey: string;
|
||||||
}>("get_waku_v2_private_v1_asymmetric_keypair", []);
|
}>("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(
|
async postAsymmetricMessage(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user