mirror of https://github.com/status-im/js-waku.git
chore: nwaku latest fixes (#1844)
* nwaku latest fixes * small fixes * other fixes * other fixes
This commit is contained in:
parent
90fc9a3e94
commit
a9fb796a7b
|
@ -127,7 +127,8 @@ describe("Waku Filter V2: Multiple PubsubTopics", function () {
|
|||
filter: true,
|
||||
lightpush: true,
|
||||
relay: true,
|
||||
pubsubTopic: [customPubsubTopic2]
|
||||
pubsubTopic: [customPubsubTopic2],
|
||||
clusterId: 3
|
||||
});
|
||||
await waku.dial(await nwaku2.getMultiaddrWithId());
|
||||
await waitForRemotePeer(waku, [Protocols.Filter, Protocols.LightPush]);
|
||||
|
@ -309,7 +310,8 @@ describe("Waku Filter V2 (Autosharding): Multiple PubsubTopics", function () {
|
|||
filter: true,
|
||||
lightpush: true,
|
||||
relay: true,
|
||||
pubsubTopic: [autoshardingPubsubTopic2]
|
||||
pubsubTopic: [autoshardingPubsubTopic2],
|
||||
clusterId: 3
|
||||
});
|
||||
await waku.dial(await nwaku2.getMultiaddrWithId());
|
||||
await waitForRemotePeer(waku, [Protocols.Filter, Protocols.LightPush]);
|
||||
|
@ -464,7 +466,8 @@ describe("Waku Filter V2 (Named sharding): Multiple PubsubTopics", function () {
|
|||
filter: true,
|
||||
lightpush: true,
|
||||
relay: true,
|
||||
pubsubTopic: [customPubsubTopic2]
|
||||
pubsubTopic: [customPubsubTopic2],
|
||||
clusterId: 3
|
||||
});
|
||||
await waku.dial(await nwaku2.getMultiaddrWithId());
|
||||
await waitForRemotePeer(waku, [Protocols.Filter, Protocols.LightPush]);
|
||||
|
|
|
@ -40,8 +40,8 @@ describe("getConnectedPeersForProtocolAndShard", function () {
|
|||
this.timeout(15000);
|
||||
|
||||
const shardInfo: ShardInfo = {
|
||||
clusterId: 1,
|
||||
shards: [1]
|
||||
clusterId: 2,
|
||||
shards: [2]
|
||||
};
|
||||
|
||||
await serviceNode1.start({
|
||||
|
@ -68,17 +68,18 @@ describe("getConnectedPeersForProtocolAndShard", function () {
|
|||
expect(peers.length).to.be.greaterThan(0);
|
||||
});
|
||||
|
||||
// Had to use cluster 0 because of https://github.com/waku-org/js-waku/issues/1848
|
||||
it("same cluster, different shard: nodes connect", async function () {
|
||||
this.timeout(15000);
|
||||
|
||||
const shardInfo: ShardInfo = {
|
||||
clusterId: 1,
|
||||
clusterId: 0,
|
||||
shards: [1]
|
||||
};
|
||||
|
||||
const shardInfoServiceNode: ShardInfo = {
|
||||
clusterId: 1,
|
||||
shards: [2]
|
||||
clusterId: 0,
|
||||
shards: [1]
|
||||
};
|
||||
|
||||
await serviceNode1.start({
|
||||
|
@ -110,12 +111,12 @@ describe("getConnectedPeersForProtocolAndShard", function () {
|
|||
this.timeout(15000);
|
||||
|
||||
const shardInfo1: ShardInfo = {
|
||||
clusterId: 1,
|
||||
clusterId: 2,
|
||||
shards: [1]
|
||||
};
|
||||
|
||||
const shardInfo2: ShardInfo = {
|
||||
clusterId: 2,
|
||||
clusterId: 3,
|
||||
shards: [1]
|
||||
};
|
||||
|
||||
|
@ -162,12 +163,12 @@ describe("getConnectedPeersForProtocolAndShard", function () {
|
|||
this.timeout(15000);
|
||||
|
||||
const shardInfo1: ShardInfo = {
|
||||
clusterId: 1,
|
||||
clusterId: 2,
|
||||
shards: [1]
|
||||
};
|
||||
|
||||
const shardInfo2: ShardInfo = {
|
||||
clusterId: 2,
|
||||
clusterId: 3,
|
||||
shards: [2]
|
||||
};
|
||||
|
||||
|
@ -214,7 +215,7 @@ describe("getConnectedPeersForProtocolAndShard", function () {
|
|||
this.timeout(15000);
|
||||
|
||||
const shardInfo: ContentTopicInfo = {
|
||||
clusterId: 1,
|
||||
clusterId: 2,
|
||||
contentTopics: [contentTopic]
|
||||
};
|
||||
|
||||
|
@ -246,12 +247,12 @@ describe("getConnectedPeersForProtocolAndShard", function () {
|
|||
this.timeout(15000);
|
||||
|
||||
const shardInfo1: ContentTopicInfo = {
|
||||
clusterId: 1,
|
||||
clusterId: 2,
|
||||
contentTopics: [contentTopic]
|
||||
};
|
||||
|
||||
const shardInfo2: ContentTopicInfo = {
|
||||
clusterId: 1,
|
||||
clusterId: 2,
|
||||
contentTopics: ["/test/5/waku-light-push/utf8"]
|
||||
};
|
||||
|
||||
|
@ -298,12 +299,12 @@ describe("getConnectedPeersForProtocolAndShard", function () {
|
|||
this.timeout(15000);
|
||||
|
||||
const shardInfo1: ContentTopicInfo = {
|
||||
clusterId: 1,
|
||||
clusterId: 2,
|
||||
contentTopics: [contentTopic]
|
||||
};
|
||||
|
||||
const shardInfo2: ContentTopicInfo = {
|
||||
clusterId: 2,
|
||||
clusterId: 3,
|
||||
contentTopics: [contentTopic]
|
||||
};
|
||||
|
||||
|
@ -350,12 +351,12 @@ describe("getConnectedPeersForProtocolAndShard", function () {
|
|||
this.timeout(15000);
|
||||
|
||||
const shardInfo1: ContentTopicInfo = {
|
||||
clusterId: 1,
|
||||
clusterId: 2,
|
||||
contentTopics: [contentTopic]
|
||||
};
|
||||
|
||||
const shardInfo2: ContentTopicInfo = {
|
||||
clusterId: 2,
|
||||
clusterId: 3,
|
||||
contentTopics: ["/test/5/waku-light-push/utf8"]
|
||||
};
|
||||
|
||||
|
|
|
@ -185,9 +185,7 @@ describe("Waku Light Push (Autosharding): Multiple PubsubTopics", function () {
|
|||
let nwaku2: ServiceNode;
|
||||
let messageCollector: MessageCollector;
|
||||
|
||||
// When using lightpush, we have to use a cluster id of 1 because that is the default cluster id for autosharding
|
||||
// With a different cluster id, we never find a viable peer
|
||||
const clusterId = 1;
|
||||
const clusterId = 2;
|
||||
const customContentTopic1 = "/waku/2/content/test.js";
|
||||
const customContentTopic2 = "/myapp/1/latest/proto";
|
||||
const autoshardingPubsubTopic1 = contentTopicToPubsubTopic(
|
||||
|
|
|
@ -33,7 +33,7 @@ describe("Metadata Protocol", function () {
|
|||
describe("connections", function () {
|
||||
it("same cluster, same shard: nodes connect", async function () {
|
||||
const shardInfo: ShardInfo = {
|
||||
clusterId: 1,
|
||||
clusterId: 2,
|
||||
shards: [1]
|
||||
};
|
||||
|
||||
|
@ -62,14 +62,15 @@ describe("Metadata Protocol", function () {
|
|||
expect(activeConnections.length).to.equal(1);
|
||||
});
|
||||
|
||||
// Had to use cluster 0 because of https://github.com/waku-org/js-waku/issues/1848
|
||||
it("same cluster, different shard: nodes connect", async function () {
|
||||
const shardInfo1: ShardInfo = {
|
||||
clusterId: 1,
|
||||
clusterId: 0,
|
||||
shards: [1]
|
||||
};
|
||||
|
||||
const shardInfo2: ShardInfo = {
|
||||
clusterId: 1,
|
||||
clusterId: 0,
|
||||
shards: [2]
|
||||
};
|
||||
|
||||
|
@ -100,12 +101,12 @@ describe("Metadata Protocol", function () {
|
|||
|
||||
it("different cluster, same shard: nodes don't connect", async function () {
|
||||
const shardInfo1: ShardInfo = {
|
||||
clusterId: 1,
|
||||
clusterId: 2,
|
||||
shards: [1]
|
||||
};
|
||||
|
||||
const shardInfo2: ShardInfo = {
|
||||
clusterId: 2,
|
||||
clusterId: 3,
|
||||
shards: [1]
|
||||
};
|
||||
|
||||
|
@ -132,12 +133,12 @@ describe("Metadata Protocol", function () {
|
|||
|
||||
it("different cluster, different shard: nodes don't connect", async function () {
|
||||
const shardInfo1: ShardInfo = {
|
||||
clusterId: 1,
|
||||
clusterId: 2,
|
||||
shards: [1]
|
||||
};
|
||||
|
||||
const shardInfo2: ShardInfo = {
|
||||
clusterId: 2,
|
||||
clusterId: 3,
|
||||
shards: [2]
|
||||
};
|
||||
|
||||
|
@ -165,7 +166,7 @@ describe("Metadata Protocol", function () {
|
|||
|
||||
it("PeerStore has remote peer's shard info after successful connection", async function () {
|
||||
const shardInfo: ShardInfo = {
|
||||
clusterId: 1,
|
||||
clusterId: 2,
|
||||
shards: [1]
|
||||
};
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ describe("Peer Exchange", () => {
|
|||
});
|
||||
|
||||
it.skip("nwaku interop", async function () {
|
||||
this.timeout(55_000);
|
||||
this.timeout(100_000);
|
||||
|
||||
await nwaku1.start({
|
||||
relay: true,
|
||||
|
@ -120,7 +120,7 @@ describe("Peer Exchange", () => {
|
|||
});
|
||||
|
||||
describe("Compliance Test", function () {
|
||||
this.timeout(55_000);
|
||||
this.timeout(100_000);
|
||||
|
||||
let waku: LightNode;
|
||||
let nwaku1: ServiceNode;
|
||||
|
|
|
@ -33,6 +33,7 @@ describe("Static Sharding: Peer Management", function () {
|
|||
let nwaku3: ServiceNode;
|
||||
|
||||
let dialPeerSpy: SinonSpy;
|
||||
const clusterId = 18;
|
||||
|
||||
beforeEach(async function () {
|
||||
this.timeout(15000);
|
||||
|
@ -51,15 +52,16 @@ describe("Static Sharding: Peer Management", function () {
|
|||
this.timeout(100_000);
|
||||
|
||||
const pubsubTopics = [
|
||||
singleShardInfoToPubsubTopic({ clusterId: 18, shard: 2 })
|
||||
singleShardInfoToPubsubTopic({ clusterId: clusterId, shard: 2 })
|
||||
];
|
||||
const shardInfo: ShardInfo = { clusterId: 18, shards: [2] };
|
||||
const shardInfo: ShardInfo = { clusterId: clusterId, shards: [2] };
|
||||
|
||||
await nwaku1.start({
|
||||
pubsubTopic: pubsubTopics,
|
||||
discv5Discovery: true,
|
||||
peerExchange: true,
|
||||
relay: true
|
||||
relay: true,
|
||||
clusterId: clusterId
|
||||
});
|
||||
|
||||
const enr1 = (await nwaku1.info()).enrUri;
|
||||
|
@ -69,7 +71,8 @@ describe("Static Sharding: Peer Management", function () {
|
|||
discv5Discovery: true,
|
||||
peerExchange: true,
|
||||
discv5BootstrapNode: enr1,
|
||||
relay: true
|
||||
relay: true,
|
||||
clusterId: clusterId
|
||||
});
|
||||
|
||||
const enr2 = (await nwaku2.info()).enrUri;
|
||||
|
@ -79,7 +82,8 @@ describe("Static Sharding: Peer Management", function () {
|
|||
discv5Discovery: true,
|
||||
peerExchange: true,
|
||||
discv5BootstrapNode: enr2,
|
||||
relay: true
|
||||
relay: true,
|
||||
clusterId: clusterId
|
||||
});
|
||||
const nwaku3Ma = await nwaku3.getMultiaddrWithId();
|
||||
|
||||
|
@ -123,11 +127,11 @@ describe("Static Sharding: Peer Management", function () {
|
|||
it("px service nodes not subscribed to the shard should not be dialed", async function () {
|
||||
this.timeout(100_000);
|
||||
const pubsubTopicsToDial = [
|
||||
singleShardInfoToPubsubTopic({ clusterId: 18, shard: 2 })
|
||||
singleShardInfoToPubsubTopic({ clusterId: clusterId, shard: 2 })
|
||||
];
|
||||
const shardInfoToDial: ShardInfo = { clusterId: 18, shards: [2] };
|
||||
const shardInfoToDial: ShardInfo = { clusterId: clusterId, shards: [2] };
|
||||
const pubsubTopicsToIgnore = [
|
||||
singleShardInfoToPubsubTopic({ clusterId: 18, shard: 1 })
|
||||
singleShardInfoToPubsubTopic({ clusterId: clusterId, shard: 1 })
|
||||
];
|
||||
|
||||
// this service node is not subscribed to the shard
|
||||
|
@ -135,7 +139,8 @@ describe("Static Sharding: Peer Management", function () {
|
|||
pubsubTopic: pubsubTopicsToIgnore,
|
||||
relay: true,
|
||||
discv5Discovery: true,
|
||||
peerExchange: true
|
||||
peerExchange: true,
|
||||
clusterId: clusterId
|
||||
});
|
||||
|
||||
const enr1 = (await nwaku1.info()).enrUri;
|
||||
|
@ -145,16 +150,19 @@ describe("Static Sharding: Peer Management", function () {
|
|||
relay: true,
|
||||
discv5Discovery: true,
|
||||
peerExchange: true,
|
||||
discv5BootstrapNode: enr1
|
||||
discv5BootstrapNode: enr1,
|
||||
clusterId: clusterId
|
||||
});
|
||||
|
||||
const enr2 = (await nwaku2.info()).enrUri;
|
||||
|
||||
await nwaku3.start({
|
||||
pubsubTopic: pubsubTopicsToDial,
|
||||
relay: true,
|
||||
discv5Discovery: true,
|
||||
peerExchange: true,
|
||||
discv5BootstrapNode: enr2
|
||||
discv5BootstrapNode: enr2,
|
||||
clusterId: clusterId
|
||||
});
|
||||
const nwaku3Ma = await nwaku3.getMultiaddrWithId();
|
||||
|
||||
|
@ -198,6 +206,7 @@ describe("Static Sharding: Peer Management", function () {
|
|||
|
||||
describe("Autosharding: Peer Management", function () {
|
||||
const ContentTopic = "/waku/2/content/test.js";
|
||||
const clusterId = 2;
|
||||
|
||||
describe("Peer Exchange", function () {
|
||||
let waku: LightNode;
|
||||
|
@ -223,9 +232,9 @@ describe("Autosharding: Peer Management", function () {
|
|||
it("all px service nodes subscribed to the shard topic should be dialed", async function () {
|
||||
this.timeout(100_000);
|
||||
|
||||
const pubsubTopics = [contentTopicToPubsubTopic(ContentTopic, 1)];
|
||||
const pubsubTopics = [contentTopicToPubsubTopic(ContentTopic, clusterId)];
|
||||
const contentTopicInfo: ContentTopicInfo = {
|
||||
clusterId: 1,
|
||||
clusterId: clusterId,
|
||||
contentTopics: [ContentTopic]
|
||||
};
|
||||
|
||||
|
@ -233,7 +242,8 @@ describe("Autosharding: Peer Management", function () {
|
|||
pubsubTopic: pubsubTopics,
|
||||
discv5Discovery: true,
|
||||
peerExchange: true,
|
||||
relay: true
|
||||
relay: true,
|
||||
clusterId: clusterId
|
||||
});
|
||||
|
||||
const enr1 = (await nwaku1.info()).enrUri;
|
||||
|
@ -243,7 +253,8 @@ describe("Autosharding: Peer Management", function () {
|
|||
discv5Discovery: true,
|
||||
peerExchange: true,
|
||||
discv5BootstrapNode: enr1,
|
||||
relay: true
|
||||
relay: true,
|
||||
clusterId: clusterId
|
||||
});
|
||||
|
||||
const enr2 = (await nwaku2.info()).enrUri;
|
||||
|
@ -253,7 +264,8 @@ describe("Autosharding: Peer Management", function () {
|
|||
discv5Discovery: true,
|
||||
peerExchange: true,
|
||||
discv5BootstrapNode: enr2,
|
||||
relay: true
|
||||
relay: true,
|
||||
clusterId: clusterId
|
||||
});
|
||||
const nwaku3Ma = await nwaku3.getMultiaddrWithId();
|
||||
|
||||
|
@ -296,19 +308,22 @@ describe("Autosharding: Peer Management", function () {
|
|||
|
||||
it("px service nodes not subscribed to the shard should not be dialed", async function () {
|
||||
this.timeout(100_000);
|
||||
const pubsubTopicsToDial = [contentTopicToPubsubTopic(ContentTopic, 1)];
|
||||
const pubsubTopicsToDial = [
|
||||
contentTopicToPubsubTopic(ContentTopic, clusterId)
|
||||
];
|
||||
const contentTopicInfoToDial: ContentTopicInfo = {
|
||||
clusterId: 1,
|
||||
clusterId: clusterId,
|
||||
contentTopics: [ContentTopic]
|
||||
};
|
||||
const pubsubTopicsToIgnore = [contentTopicToPubsubTopic(ContentTopic, 2)];
|
||||
const pubsubTopicsToIgnore = [contentTopicToPubsubTopic(ContentTopic, 3)];
|
||||
|
||||
// this service node is not subscribed to the shard
|
||||
await nwaku1.start({
|
||||
pubsubTopic: pubsubTopicsToIgnore,
|
||||
relay: true,
|
||||
discv5Discovery: true,
|
||||
peerExchange: true
|
||||
peerExchange: true,
|
||||
clusterId: 3
|
||||
});
|
||||
|
||||
const enr1 = (await nwaku1.info()).enrUri;
|
||||
|
@ -318,16 +333,19 @@ describe("Autosharding: Peer Management", function () {
|
|||
relay: true,
|
||||
discv5Discovery: true,
|
||||
peerExchange: true,
|
||||
discv5BootstrapNode: enr1
|
||||
discv5BootstrapNode: enr1,
|
||||
clusterId: clusterId
|
||||
});
|
||||
|
||||
const enr2 = (await nwaku2.info()).enrUri;
|
||||
|
||||
await nwaku3.start({
|
||||
pubsubTopic: pubsubTopicsToDial,
|
||||
relay: true,
|
||||
discv5Discovery: true,
|
||||
peerExchange: true,
|
||||
discv5BootstrapNode: enr2
|
||||
discv5BootstrapNode: enr2,
|
||||
clusterId: clusterId
|
||||
});
|
||||
const nwaku3Ma = await nwaku3.getMultiaddrWithId();
|
||||
|
||||
|
|
|
@ -180,7 +180,8 @@ describe("Waku Store, custom pubsub topic", function () {
|
|||
});
|
||||
});
|
||||
|
||||
describe("Waku Store (Autosharding), custom pubsub topic", function () {
|
||||
// Skipped until https://github.com/waku-org/js-waku/issues/1845 gets fixed
|
||||
describe.skip("Waku Store (Autosharding), custom pubsub topic", function () {
|
||||
this.timeout(15000);
|
||||
let waku: LightNode;
|
||||
let nwaku: ServiceNode;
|
||||
|
@ -188,7 +189,7 @@ describe("Waku Store (Autosharding), custom pubsub topic", function () {
|
|||
|
||||
const customContentTopic1 = "/waku/2/content/utf8";
|
||||
const customContentTopic2 = "/myapp/1/latest/proto";
|
||||
const clusterId = 1;
|
||||
const clusterId = 2;
|
||||
const autoshardingPubsubTopic1 = contentTopicToPubsubTopic(
|
||||
customContentTopic1,
|
||||
clusterId
|
||||
|
|
Loading…
Reference in New Issue