2021-05-10 15:53:05 +10:00
|
|
|
/**
|
|
|
|
|
* Some constants for test purposes.
|
|
|
|
|
*
|
|
|
|
|
* @hidden
|
|
|
|
|
* @module
|
|
|
|
|
*/
|
|
|
|
|
|
2025-07-19 21:50:51 +10:00
|
|
|
import { AutoSharding, ShardInfo } from "@waku/interfaces";
|
feat!: Introduce routing info concept
Concepts are being mixed up between the global network config (static vs auto sharding), that needs to be the same of all nodes in the network, individual node configuration (eg relay node subscribing to a given shard), and the routing characteristic of a specific message (eg pubsub topic, shard).
This stops proper configuration of nwaku post 0.36.0 because we know need to be deliberate on whether nwaku nodes are running with auto or static sharding.
It also included various back and forth conversions between shards, pubsub topics, etc.
With this change, we tidy up the network configuration, and make it explicit whether it is static or auto sharded.
We also introduce the concept of routing info, which is specific to a message, and tied to the overall network configuration.
Routing info abstract pubsub topic, shard, and autosharding needs. Which should lead to easier tidy up of the pubsub concept at a later stage.
# Conflicts:
# packages/core/src/lib/connection_manager/connection_manager.ts
# packages/core/src/lib/metadata/metadata.ts
# packages/interfaces/src/metadata.ts
# packages/interfaces/src/sharding.ts
# packages/relay/src/create.ts
# packages/sdk/src/filter/filter.ts
# packages/sdk/src/filter/types.ts
# packages/sdk/src/light_push/light_push.spec.ts
# packages/tests/tests/sharding/auto_sharding.spec.ts
# packages/tests/tests/sharding/static_sharding.spec.ts
# Conflicts:
# packages/sdk/src/store/store.ts
2025-07-11 13:33:45 +10:00
|
|
|
import { createRoutingInfo } from "@waku/utils";
|
2024-07-26 01:21:52 +03:00
|
|
|
|
2022-02-16 14:08:48 +11:00
|
|
|
export const NOISE_KEY_1 = new Uint8Array(
|
|
|
|
|
((): number[] => {
|
|
|
|
|
const b = [];
|
|
|
|
|
for (let i = 0; i < 32; i++) {
|
|
|
|
|
b.push(1);
|
|
|
|
|
}
|
|
|
|
|
return b;
|
2023-08-16 20:18:13 +05:30
|
|
|
})()
|
2022-02-16 14:08:48 +11:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export const NOISE_KEY_2 = new Uint8Array(
|
|
|
|
|
((): number[] => {
|
|
|
|
|
const b = [];
|
|
|
|
|
for (let i = 0; i < 32; i++) {
|
|
|
|
|
b.push(2);
|
|
|
|
|
}
|
|
|
|
|
return b;
|
2023-08-16 20:18:13 +05:30
|
|
|
})()
|
2022-02-16 14:08:48 +11:00
|
|
|
);
|
2022-07-25 16:51:33 +10:00
|
|
|
|
|
|
|
|
export const NOISE_KEY_3 = new Uint8Array(
|
|
|
|
|
((): number[] => {
|
|
|
|
|
const b = [];
|
|
|
|
|
for (let i = 0; i < 32; i++) {
|
|
|
|
|
b.push(3);
|
|
|
|
|
}
|
|
|
|
|
return b;
|
2023-08-16 20:18:13 +05:30
|
|
|
})()
|
2022-07-25 16:51:33 +10:00
|
|
|
);
|
2023-09-13 00:31:35 +03:00
|
|
|
|
|
|
|
|
export const TEST_STRING = [
|
|
|
|
|
{ description: "short", value: "hi" },
|
|
|
|
|
{ description: "long", value: "A".repeat(10000) },
|
|
|
|
|
{ description: "numeric", value: "1234567890" },
|
|
|
|
|
{ description: "special chars", value: "!@#$%^&*()_+" },
|
|
|
|
|
{ description: "Chinese", value: "你好" },
|
|
|
|
|
{ description: "Arabic", value: "مرحبا" },
|
|
|
|
|
{ description: "Russian", value: "Привет" },
|
|
|
|
|
{ description: "SQL Injection", value: "'; DROP TABLE users; --" },
|
feat!: Introduce routing info concept
Concepts are being mixed up between the global network config (static vs auto sharding), that needs to be the same of all nodes in the network, individual node configuration (eg relay node subscribing to a given shard), and the routing characteristic of a specific message (eg pubsub topic, shard).
This stops proper configuration of nwaku post 0.36.0 because we know need to be deliberate on whether nwaku nodes are running with auto or static sharding.
It also included various back and forth conversions between shards, pubsub topics, etc.
With this change, we tidy up the network configuration, and make it explicit whether it is static or auto sharded.
We also introduce the concept of routing info, which is specific to a message, and tied to the overall network configuration.
Routing info abstract pubsub topic, shard, and autosharding needs. Which should lead to easier tidy up of the pubsub concept at a later stage.
# Conflicts:
# packages/core/src/lib/connection_manager/connection_manager.ts
# packages/core/src/lib/metadata/metadata.ts
# packages/interfaces/src/metadata.ts
# packages/interfaces/src/sharding.ts
# packages/relay/src/create.ts
# packages/sdk/src/filter/filter.ts
# packages/sdk/src/filter/types.ts
# packages/sdk/src/light_push/light_push.spec.ts
# packages/tests/tests/sharding/auto_sharding.spec.ts
# packages/tests/tests/sharding/static_sharding.spec.ts
# Conflicts:
# packages/sdk/src/store/store.ts
2025-07-11 13:33:45 +10:00
|
|
|
{
|
|
|
|
|
description: "Script",
|
|
|
|
|
value: '<script>alert("hacked");</script>',
|
|
|
|
|
invalidContentTopic: true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
description: "XML",
|
|
|
|
|
value: "<element>Some content</element>",
|
|
|
|
|
invalidContentTopic: true
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
description: "Basic HTML tag",
|
|
|
|
|
value: "<h1>Heading</h1>",
|
|
|
|
|
invalidContentTopic: true
|
|
|
|
|
},
|
2023-09-13 00:31:35 +03:00
|
|
|
{ description: "JSON", value: '{"user":"admin","password":"123456"}' },
|
feat!: Introduce routing info concept
Concepts are being mixed up between the global network config (static vs auto sharding), that needs to be the same of all nodes in the network, individual node configuration (eg relay node subscribing to a given shard), and the routing characteristic of a specific message (eg pubsub topic, shard).
This stops proper configuration of nwaku post 0.36.0 because we know need to be deliberate on whether nwaku nodes are running with auto or static sharding.
It also included various back and forth conversions between shards, pubsub topics, etc.
With this change, we tidy up the network configuration, and make it explicit whether it is static or auto sharded.
We also introduce the concept of routing info, which is specific to a message, and tied to the overall network configuration.
Routing info abstract pubsub topic, shard, and autosharding needs. Which should lead to easier tidy up of the pubsub concept at a later stage.
# Conflicts:
# packages/core/src/lib/connection_manager/connection_manager.ts
# packages/core/src/lib/metadata/metadata.ts
# packages/interfaces/src/metadata.ts
# packages/interfaces/src/sharding.ts
# packages/relay/src/create.ts
# packages/sdk/src/filter/filter.ts
# packages/sdk/src/filter/types.ts
# packages/sdk/src/light_push/light_push.spec.ts
# packages/tests/tests/sharding/auto_sharding.spec.ts
# packages/tests/tests/sharding/static_sharding.spec.ts
# Conflicts:
# packages/sdk/src/store/store.ts
2025-07-11 13:33:45 +10:00
|
|
|
{
|
|
|
|
|
description: "shell command",
|
|
|
|
|
value: "`rm -rf /`",
|
|
|
|
|
invalidContentTopic: true
|
|
|
|
|
},
|
2023-09-13 00:31:35 +03:00
|
|
|
{ description: "escaped characters", value: "\\n\\t\\0" },
|
2023-10-23 18:08:33 +03:00
|
|
|
{ description: "unicode special characters", value: "\u202Ereverse" },
|
|
|
|
|
{ description: "emoji", value: "🤫 🤥 😶 😶🌫️ 😐 😑 😬 🫨 🫠 🙄 😯 😦 😧 😮" }
|
2023-09-13 00:31:35 +03:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export const TEST_TIMESTAMPS = [
|
|
|
|
|
BigInt(Date.now()) * BigInt(1000000),
|
|
|
|
|
Date.now(),
|
|
|
|
|
1649153314,
|
2024-02-15 17:53:51 -08:00
|
|
|
1949153314000
|
2023-09-13 00:31:35 +03:00
|
|
|
];
|
2024-02-15 08:50:03 +02:00
|
|
|
|
|
|
|
|
export const MOCHA_HOOK_MAX_TIMEOUT = 50_000;
|
2024-05-01 19:58:28 -07:00
|
|
|
|
|
|
|
|
export const SEPOLIA_RPC_URL =
|
|
|
|
|
process.env.SEPOLIA_RPC_URL || "https://sepolia.gateway.tenderly.co";
|
2024-07-26 01:21:52 +03:00
|
|
|
|
feat!: Introduce routing info concept
Concepts are being mixed up between the global network config (static vs auto sharding), that needs to be the same of all nodes in the network, individual node configuration (eg relay node subscribing to a given shard), and the routing characteristic of a specific message (eg pubsub topic, shard).
This stops proper configuration of nwaku post 0.36.0 because we know need to be deliberate on whether nwaku nodes are running with auto or static sharding.
It also included various back and forth conversions between shards, pubsub topics, etc.
With this change, we tidy up the network configuration, and make it explicit whether it is static or auto sharded.
We also introduce the concept of routing info, which is specific to a message, and tied to the overall network configuration.
Routing info abstract pubsub topic, shard, and autosharding needs. Which should lead to easier tidy up of the pubsub concept at a later stage.
# Conflicts:
# packages/core/src/lib/connection_manager/connection_manager.ts
# packages/core/src/lib/metadata/metadata.ts
# packages/interfaces/src/metadata.ts
# packages/interfaces/src/sharding.ts
# packages/relay/src/create.ts
# packages/sdk/src/filter/filter.ts
# packages/sdk/src/filter/types.ts
# packages/sdk/src/light_push/light_push.spec.ts
# packages/tests/tests/sharding/auto_sharding.spec.ts
# packages/tests/tests/sharding/static_sharding.spec.ts
# Conflicts:
# packages/sdk/src/store/store.ts
2025-07-11 13:33:45 +10:00
|
|
|
export const DefaultTestClusterId = 0;
|
|
|
|
|
export const DefaultTestNumShardsInCluster = 10;
|
|
|
|
|
export const DefaultTestNetworkConfig: AutoSharding = {
|
|
|
|
|
clusterId: DefaultTestClusterId,
|
|
|
|
|
numShardsInCluster: DefaultTestNumShardsInCluster
|
2024-07-26 01:21:52 +03:00
|
|
|
};
|
2025-07-19 21:50:51 +10:00
|
|
|
export const DefaultTestShardInfo: ShardInfo = {
|
feat!: Introduce routing info concept
Concepts are being mixed up between the global network config (static vs auto sharding), that needs to be the same of all nodes in the network, individual node configuration (eg relay node subscribing to a given shard), and the routing characteristic of a specific message (eg pubsub topic, shard).
This stops proper configuration of nwaku post 0.36.0 because we know need to be deliberate on whether nwaku nodes are running with auto or static sharding.
It also included various back and forth conversions between shards, pubsub topics, etc.
With this change, we tidy up the network configuration, and make it explicit whether it is static or auto sharded.
We also introduce the concept of routing info, which is specific to a message, and tied to the overall network configuration.
Routing info abstract pubsub topic, shard, and autosharding needs. Which should lead to easier tidy up of the pubsub concept at a later stage.
# Conflicts:
# packages/core/src/lib/connection_manager/connection_manager.ts
# packages/core/src/lib/metadata/metadata.ts
# packages/interfaces/src/metadata.ts
# packages/interfaces/src/sharding.ts
# packages/relay/src/create.ts
# packages/sdk/src/filter/filter.ts
# packages/sdk/src/filter/types.ts
# packages/sdk/src/light_push/light_push.spec.ts
# packages/tests/tests/sharding/auto_sharding.spec.ts
# packages/tests/tests/sharding/static_sharding.spec.ts
# Conflicts:
# packages/sdk/src/store/store.ts
2025-07-11 13:33:45 +10:00
|
|
|
clusterId: DefaultTestClusterId,
|
|
|
|
|
shards: [0]
|
2024-07-26 01:21:52 +03:00
|
|
|
};
|
feat!: Introduce routing info concept
Concepts are being mixed up between the global network config (static vs auto sharding), that needs to be the same of all nodes in the network, individual node configuration (eg relay node subscribing to a given shard), and the routing characteristic of a specific message (eg pubsub topic, shard).
This stops proper configuration of nwaku post 0.36.0 because we know need to be deliberate on whether nwaku nodes are running with auto or static sharding.
It also included various back and forth conversions between shards, pubsub topics, etc.
With this change, we tidy up the network configuration, and make it explicit whether it is static or auto sharded.
We also introduce the concept of routing info, which is specific to a message, and tied to the overall network configuration.
Routing info abstract pubsub topic, shard, and autosharding needs. Which should lead to easier tidy up of the pubsub concept at a later stage.
# Conflicts:
# packages/core/src/lib/connection_manager/connection_manager.ts
# packages/core/src/lib/metadata/metadata.ts
# packages/interfaces/src/metadata.ts
# packages/interfaces/src/sharding.ts
# packages/relay/src/create.ts
# packages/sdk/src/filter/filter.ts
# packages/sdk/src/filter/types.ts
# packages/sdk/src/light_push/light_push.spec.ts
# packages/tests/tests/sharding/auto_sharding.spec.ts
# packages/tests/tests/sharding/static_sharding.spec.ts
# Conflicts:
# packages/sdk/src/store/store.ts
2025-07-11 13:33:45 +10:00
|
|
|
export const DefaultTestContentTopic = "/test/1/content-topic/proto";
|
|
|
|
|
export const DefaultTestRoutingInfo = createRoutingInfo(
|
|
|
|
|
DefaultTestNetworkConfig,
|
|
|
|
|
{ contentTopic: DefaultTestContentTopic }
|
|
|
|
|
);
|