Ensure waku relay node does not use a sub protocol

At the moment we do not assert that we publish messages over waku relay
protocol (not sure this assertion is possible).
By asserting we do not register any sub (pubsub, gossipsub, floodsub)
protocols, we can be (more) confident that this
protocols are not be used behind the scenes.
This commit is contained in:
Franck Royer 2021-03-10 16:25:54 +11:00
parent 4329b8006e
commit b8c63355a5
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 7 additions and 0 deletions

View File

@ -44,6 +44,13 @@ test('Register waku relay protocol', async (t) => {
t.truthy(protocols.findIndex((value) => value == CODEC));
});
test('Does not register any sub protocol', async (t) => {
const node = await createNode();
const protocols = Array.from(node.upgrader.protocols.keys());
t.truthy(protocols.findIndex((value) => value.match(/sub/)));
});
function waitForNextData(pubsub: Pubsub): Promise<Message> {
return new Promise((resolve) => {
pubsub.once(TOPIC, resolve);