@streamr/trackerless-network 101.1.1 → 102.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +7 -7
- package/dist/src/NetworkNode.d.ts +6 -6
- package/dist/src/NetworkNode.js +5 -3
- package/dist/src/NetworkNode.js.map +1 -1
- package/dist/src/NetworkStack.js +3 -2
- package/dist/src/NetworkStack.js.map +1 -1
- package/dist/src/logic/ContentDeliveryLayerNode.d.ts +4 -1
- package/dist/src/logic/ContentDeliveryLayerNode.js +25 -5
- package/dist/src/logic/ContentDeliveryLayerNode.js.map +1 -1
- package/dist/src/logic/ContentDeliveryManager.d.ts +6 -2
- package/dist/src/logic/ContentDeliveryManager.js +26 -6
- package/dist/src/logic/ContentDeliveryManager.js.map +1 -1
- package/dist/src/logic/ContentDeliveryRpcLocal.js +2 -2
- package/dist/src/logic/ContentDeliveryRpcLocal.js.map +1 -1
- package/dist/src/logic/ContentDeliveryRpcRemote.d.ts +3 -0
- package/dist/src/logic/ContentDeliveryRpcRemote.js +7 -0
- package/dist/src/logic/ContentDeliveryRpcRemote.js.map +1 -1
- package/dist/src/logic/DuplicateMessageDetector.js +2 -2
- package/dist/src/logic/DuplicateMessageDetector.js.map +1 -1
- package/dist/src/logic/ExternalNetworkRpc.js.map +1 -1
- package/dist/src/logic/NodeList.js +2 -2
- package/dist/src/logic/NodeList.js.map +1 -1
- package/dist/src/logic/PeerDescriptorStoreManager.js +0 -1
- package/dist/src/logic/PeerDescriptorStoreManager.js.map +1 -1
- package/dist/src/logic/StreamPartNetworkSplitAvoidance.js +4 -3
- package/dist/src/logic/StreamPartNetworkSplitAvoidance.js.map +1 -1
- package/dist/src/logic/createContentDeliveryLayerNode.js +1 -1
- package/dist/src/logic/createContentDeliveryLayerNode.js.map +1 -1
- package/dist/src/logic/inspect/Inspector.js +3 -3
- package/dist/src/logic/inspect/Inspector.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js +9 -9
- package/dist/src/logic/neighbor-discovery/HandshakeRpcLocal.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.js +5 -5
- package/dist/src/logic/neighbor-discovery/HandshakeRpcRemote.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/Handshaker.js +12 -12
- package/dist/src/logic/neighbor-discovery/Handshaker.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborFinder.js +5 -0
- package/dist/src/logic/neighbor-discovery/NeighborFinder.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js +3 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateManager.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js +3 -3
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.js.map +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.js +1 -1
- package/dist/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.js.map +1 -1
- package/dist/src/logic/propagation/Propagation.js +0 -1
- package/dist/src/logic/propagation/Propagation.js.map +1 -1
- package/dist/src/logic/proxy/ProxyClient.d.ts +3 -2
- package/dist/src/logic/proxy/ProxyClient.js +9 -4
- package/dist/src/logic/proxy/ProxyClient.js.map +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.d.ts +2 -2
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcLocal.js.map +1 -1
- package/dist/src/logic/proxy/ProxyConnectionRpcRemote.d.ts +2 -2
- package/dist/src/logic/proxy/ProxyConnectionRpcRemote.js.map +1 -1
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js +3 -3
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcLocal.js.map +1 -1
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcRemote.js +2 -2
- package/dist/src/logic/temporary-connection/TemporaryConnectionRpcRemote.js.map +1 -1
- package/dist/src/proto/google/protobuf/any.d.ts +11 -4
- package/dist/src/proto/google/protobuf/any.js.map +1 -1
- package/dist/src/proto/google/protobuf/empty.d.ts +0 -1
- package/dist/src/proto/google/protobuf/empty.js.map +1 -1
- package/dist/src/proto/google/protobuf/timestamp.d.ts +9 -3
- package/dist/src/proto/google/protobuf/timestamp.js.map +1 -1
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.d.ts +26 -2
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.js +16 -2
- package/dist/src/proto/packages/trackerless-network/protos/NetworkRpc.js.map +1 -1
- package/dist/test/benchmark/first-message.js +1 -2
- package/dist/test/benchmark/first-message.js.map +1 -1
- package/dist/test/utils/utils.d.ts +2 -2
- package/dist/test/utils/utils.js +1 -1
- package/dist/test/utils/utils.js.map +1 -1
- package/jest.config.js +3 -0
- package/karma-setup.js +7 -0
- package/karma.config.js +1 -1
- package/package.json +7 -7
- package/protos/NetworkRpc.proto +7 -1
- package/src/NetworkNode.ts +10 -8
- package/src/NetworkStack.ts +4 -3
- package/src/logic/ContentDeliveryLayerNode.ts +30 -6
- package/src/logic/ContentDeliveryManager.ts +37 -11
- package/src/logic/ContentDeliveryRpcLocal.ts +3 -3
- package/src/logic/ContentDeliveryRpcRemote.ts +10 -0
- package/src/logic/DuplicateMessageDetector.ts +2 -2
- package/src/logic/ExternalNetworkRpc.ts +0 -1
- package/src/logic/NodeList.ts +4 -3
- package/src/logic/PeerDescriptorStoreManager.ts +0 -1
- package/src/logic/StreamPartNetworkSplitAvoidance.ts +5 -4
- package/src/logic/createContentDeliveryLayerNode.ts +2 -2
- package/src/logic/inspect/Inspector.ts +4 -4
- package/src/logic/neighbor-discovery/HandshakeRpcLocal.ts +11 -11
- package/src/logic/neighbor-discovery/HandshakeRpcRemote.ts +6 -6
- package/src/logic/neighbor-discovery/Handshaker.ts +13 -13
- package/src/logic/neighbor-discovery/NeighborFinder.ts +6 -1
- package/src/logic/neighbor-discovery/NeighborUpdateManager.ts +4 -2
- package/src/logic/neighbor-discovery/NeighborUpdateRpcLocal.ts +4 -4
- package/src/logic/neighbor-discovery/NeighborUpdateRpcRemote.ts +2 -2
- package/src/logic/propagation/Propagation.ts +0 -1
- package/src/logic/proxy/ProxyClient.ts +15 -9
- package/src/logic/proxy/ProxyConnectionRpcLocal.ts +5 -5
- package/src/logic/proxy/ProxyConnectionRpcRemote.ts +2 -2
- package/src/logic/temporary-connection/TemporaryConnectionRpcLocal.ts +4 -4
- package/src/logic/temporary-connection/TemporaryConnectionRpcRemote.ts +3 -3
- package/src/proto/google/protobuf/any.ts +11 -4
- package/src/proto/google/protobuf/empty.ts +0 -1
- package/src/proto/google/protobuf/timestamp.ts +9 -3
- package/src/proto/packages/trackerless-network/protos/NetworkRpc.ts +34 -3
- package/test/benchmark/first-message.ts +2 -3
- package/test/end-to-end/content-delivery-layer-node-with-real-connections.test.ts +2 -2
- package/test/end-to-end/inspect.test.ts +2 -2
- package/test/end-to-end/proxy-and-full-node.test.ts +4 -4
- package/test/end-to-end/proxy-connections.test.ts +3 -3
- package/test/end-to-end/proxy-key-exchange.test.ts +5 -3
- package/test/end-to-end/webrtc-full-node-network.test.ts +4 -4
- package/test/end-to-end/websocket-full-node-network.test.ts +4 -4
- package/test/integration/ContentDeliveryLayerNode-Layer1Node-Latencies.test.ts +4 -4
- package/test/integration/ContentDeliveryLayerNode-Layer1Node.test.ts +4 -4
- package/test/integration/ContentDeliveryManager.test.ts +35 -14
- package/test/integration/ContentDeliveryRpcRemote.test.ts +2 -2
- package/test/integration/Handshakes.test.ts +7 -7
- package/test/integration/Inspect.test.ts +2 -2
- package/test/integration/NetworkNode.test.ts +2 -1
- package/test/integration/NetworkRpc.test.ts +4 -4
- package/test/integration/NetworkStack.test.ts +2 -2
- package/test/integration/NodeInfoRpc.test.ts +6 -2
- package/test/integration/Propagation.test.ts +2 -2
- package/test/integration/joining-streams-on-offline-peers.test.ts +2 -2
- package/test/integration/stream-without-default-entrypoints.test.ts +2 -1
- package/test/integration/streamEntryPointReplacing.test.ts +2 -2
- package/test/types/global.d.ts +2 -0
- package/test/unit/ContentDeliveryLayerNode.test.ts +22 -10
- package/test/unit/ContentDeliveryManager.test.ts +5 -5
- package/test/unit/ContentDeliveryRpcLocal.test.ts +2 -2
- package/test/unit/HandshakeRpcLocal.test.ts +8 -8
- package/test/unit/Handshaker.test.ts +2 -2
- package/test/unit/InspectSession.test.ts +3 -3
- package/test/unit/Inspector.test.ts +4 -4
- package/test/unit/NeighborFinder.test.ts +3 -3
- package/test/unit/NeighborUpdateRpcLocal.test.ts +5 -5
- package/test/unit/NetworkNode.test.ts +2 -2
- package/test/unit/NodeList.test.ts +22 -22
- package/test/unit/PeerDescriptorStoreManager.test.ts +2 -2
- package/test/unit/Propagation.test.ts +6 -5
- package/test/unit/ProxyConnectionRpcRemote.test.ts +3 -3
- package/test/unit/TemporaryConnectionRpcLocal.test.ts +3 -3
- package/test/utils/mock/MockControlLayerNode.ts +5 -0
- package/test/utils/mock/MockTransport.ts +11 -0
- package/test/utils/utils.ts +5 -5
- package/tsconfig.jest.json +1 -1
- package/tsconfig.json +3 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
DhtNode,
|
|
5
|
-
|
|
5
|
+
toNodeId,
|
|
6
6
|
getRandomRegion,
|
|
7
7
|
LatencyType,
|
|
8
8
|
PeerDescriptor,
|
|
@@ -75,7 +75,7 @@ const measureJoiningTime = async () => {
|
|
|
75
75
|
const peerDescriptor = createMockPeerDescriptor({
|
|
76
76
|
region: getRandomRegion()
|
|
77
77
|
})
|
|
78
|
-
console.log('starting node with id ',
|
|
78
|
+
console.log('starting node with id ', toNodeId(peerDescriptor))
|
|
79
79
|
|
|
80
80
|
// start publishing ons stream
|
|
81
81
|
const stream = Array.from(streamParts.keys())[Math.floor(Math.random() * streamParts.size)]
|
|
@@ -147,7 +147,6 @@ const run = async () => {
|
|
|
147
147
|
await shutdownNetwork()
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
// eslint-disable-next-line promise/catch-or-return
|
|
151
150
|
run().then(() => {
|
|
152
151
|
console.log('done')
|
|
153
152
|
}).catch((err) => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ConnectionManager, DhtNode, PeerDescriptor } from '@streamr/dht'
|
|
2
|
-
import { randomEthereumAddress } from '@streamr/test-utils'
|
|
3
2
|
import { StreamPartIDUtils, waitForCondition } from '@streamr/utils'
|
|
4
3
|
import { ContentDeliveryLayerNode } from '../../src/logic/ContentDeliveryLayerNode'
|
|
5
4
|
import { ControlLayerNode } from '../../src/logic/ControlLayerNode'
|
|
6
5
|
import { DiscoveryLayerNode } from '../../src/logic/DiscoveryLayerNode'
|
|
7
6
|
import { createContentDeliveryLayerNode } from '../../src/logic/createContentDeliveryLayerNode'
|
|
8
7
|
import { createMockPeerDescriptor, createStreamMessage } from '../utils/utils'
|
|
8
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
9
9
|
|
|
10
10
|
describe('content delivery layer node with real connections', () => {
|
|
11
11
|
|
|
@@ -152,7 +152,7 @@ describe('content delivery layer node with real connections', () => {
|
|
|
152
152
|
const msg = createStreamMessage(
|
|
153
153
|
JSON.stringify({ hello: 'WORLD' }),
|
|
154
154
|
streamPartId,
|
|
155
|
-
|
|
155
|
+
randomUserId()
|
|
156
156
|
)
|
|
157
157
|
contentDeliveryLayerNode1.broadcast(msg)
|
|
158
158
|
await waitForCondition(() => receivedMessageCount >= 4)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
2
2
|
import { StreamPartIDUtils, hexToBinary, utf8ToBinary, waitForCondition } from '@streamr/utils'
|
|
3
3
|
import { NetworkNode, createNetworkNode } from '../../src/NetworkNode'
|
|
4
4
|
import { ContentType, EncryptionType, SignatureType, StreamMessage } from '../../src/proto/packages/trackerless-network/protos/NetworkRpc'
|
|
@@ -44,7 +44,7 @@ describe('inspect', () => {
|
|
|
44
44
|
streamPartition: StreamPartIDUtils.getStreamPartition(STREAM_PART_ID),
|
|
45
45
|
timestamp: 666,
|
|
46
46
|
sequenceNumber: 0,
|
|
47
|
-
publisherId: hexToBinary(
|
|
47
|
+
publisherId: hexToBinary(randomUserId()),
|
|
48
48
|
messageChainId: 'msgChainId'
|
|
49
49
|
},
|
|
50
50
|
previousMessageRef: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
2
2
|
import { StreamPartID, StreamPartIDUtils, hexToBinary, utf8ToBinary, waitForEvent3 } from '@streamr/utils'
|
|
3
3
|
import { NetworkNode, createNetworkNode } from '../../src/NetworkNode'
|
|
4
4
|
import {
|
|
@@ -10,16 +10,16 @@ import {
|
|
|
10
10
|
} from '../../src/proto/packages/trackerless-network/protos/NetworkRpc'
|
|
11
11
|
import { createMockPeerDescriptor } from '../utils/utils'
|
|
12
12
|
|
|
13
|
-
const PROXIED_NODE_USER_ID =
|
|
13
|
+
const PROXIED_NODE_USER_ID = randomUserId()
|
|
14
14
|
|
|
15
15
|
const createMessage = (streamPartId: StreamPartID): StreamMessage => {
|
|
16
|
-
return {
|
|
16
|
+
return {
|
|
17
17
|
messageId: {
|
|
18
18
|
streamId: StreamPartIDUtils.getStreamID(streamPartId),
|
|
19
19
|
streamPartition: StreamPartIDUtils.getStreamPartition(streamPartId),
|
|
20
20
|
timestamp: 666,
|
|
21
21
|
sequenceNumber: 0,
|
|
22
|
-
publisherId: hexToBinary(
|
|
22
|
+
publisherId: hexToBinary(randomUserId()),
|
|
23
23
|
messageChainId: 'msgChainId'
|
|
24
24
|
},
|
|
25
25
|
previousMessageRef: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DhtAddress } from '@streamr/dht'
|
|
2
|
-
import {
|
|
2
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
3
3
|
import { StreamPartIDUtils, hexToBinary, utf8ToBinary, wait, waitForCondition, waitForEvent3 } from '@streamr/utils'
|
|
4
4
|
import { NetworkNode, createNetworkNode } from '../../src/NetworkNode'
|
|
5
5
|
import { ContentDeliveryLayerNode } from '../../src/logic/ContentDeliveryLayerNode'
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from '../../src/proto/packages/trackerless-network/protos/NetworkRpc'
|
|
14
14
|
import { createMockPeerDescriptor } from '../utils/utils'
|
|
15
15
|
|
|
16
|
-
const PROXIED_NODE_USER_ID =
|
|
16
|
+
const PROXIED_NODE_USER_ID = randomUserId()
|
|
17
17
|
const STREAM_PART_ID = StreamPartIDUtils.parse('proxy-test#0')
|
|
18
18
|
const MESSAGE: StreamMessage = {
|
|
19
19
|
messageId: {
|
|
@@ -21,7 +21,7 @@ const MESSAGE: StreamMessage = {
|
|
|
21
21
|
streamPartition: StreamPartIDUtils.getStreamPartition(STREAM_PART_ID),
|
|
22
22
|
timestamp: 666,
|
|
23
23
|
sequenceNumber: 0,
|
|
24
|
-
publisherId: hexToBinary(
|
|
24
|
+
publisherId: hexToBinary(randomUserId()),
|
|
25
25
|
messageChainId: 'msgChainId'
|
|
26
26
|
},
|
|
27
27
|
previousMessageRef: {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
1
2
|
import {
|
|
2
3
|
StreamPartIDUtils,
|
|
3
|
-
hexToBinary,
|
|
4
|
+
hexToBinary,
|
|
5
|
+
waitForEvent3
|
|
4
6
|
} from '@streamr/utils'
|
|
5
7
|
import { NetworkNode, createNetworkNode } from '../../src/NetworkNode'
|
|
6
8
|
import { ProxyDirection, SignatureType, StreamMessage } from '../../src/proto/packages/trackerless-network/protos/NetworkRpc'
|
|
@@ -15,8 +17,8 @@ describe('proxy group key exchange', () => {
|
|
|
15
17
|
const publisherDescriptor = createMockPeerDescriptor()
|
|
16
18
|
const subscriberDescriptor = createMockPeerDescriptor()
|
|
17
19
|
|
|
18
|
-
const publisherUserId =
|
|
19
|
-
const subscriberUserId =
|
|
20
|
+
const publisherUserId = randomUserId()
|
|
21
|
+
const subscriberUserId = randomUserId()
|
|
20
22
|
|
|
21
23
|
let proxyNode: NetworkNode
|
|
22
24
|
let publisher: NetworkNode
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { randomEthereumAddress } from '@streamr/test-utils'
|
|
1
|
+
import { toNodeId, getRandomRegion } from '@streamr/dht'
|
|
3
2
|
import { StreamPartIDUtils, waitForCondition } from '@streamr/utils'
|
|
4
3
|
import { range } from 'lodash'
|
|
5
4
|
import { NetworkStack } from '../../src/NetworkStack'
|
|
6
5
|
import { createMockPeerDescriptor, createStreamMessage } from '../utils/utils'
|
|
6
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
7
7
|
|
|
8
8
|
describe('Full node network with WebRTC connections', () => {
|
|
9
9
|
|
|
@@ -69,14 +69,14 @@ describe('Full node network with WebRTC connections', () => {
|
|
|
69
69
|
const successIds: string[] = []
|
|
70
70
|
nodes.forEach((node) => {
|
|
71
71
|
node.getContentDeliveryManager().on('newMessage', () => {
|
|
72
|
-
successIds.push(
|
|
72
|
+
successIds.push(toNodeId(node.getContentDeliveryManager().getPeerDescriptor()))
|
|
73
73
|
receivedMessageCount += 1
|
|
74
74
|
})
|
|
75
75
|
})
|
|
76
76
|
const msg = createStreamMessage(
|
|
77
77
|
JSON.stringify({ hello: 'WORLD' }),
|
|
78
78
|
streamPartId,
|
|
79
|
-
|
|
79
|
+
randomUserId()
|
|
80
80
|
)
|
|
81
81
|
entryPoint.getContentDeliveryManager().broadcast(msg)
|
|
82
82
|
await waitForCondition(() => receivedMessageCount === NUM_OF_NODES)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { randomEthereumAddress } from '@streamr/test-utils'
|
|
1
|
+
import { toNodeId } from '@streamr/dht'
|
|
3
2
|
import { StreamPartIDUtils, waitForCondition } from '@streamr/utils'
|
|
4
3
|
import { range } from 'lodash'
|
|
5
4
|
import { NetworkStack } from '../../src/NetworkStack'
|
|
6
5
|
import { createMockPeerDescriptor, createStreamMessage } from '../utils/utils'
|
|
6
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
7
7
|
|
|
8
8
|
describe('Full node network with WebSocket connections only', () => {
|
|
9
9
|
|
|
@@ -67,7 +67,7 @@ describe('Full node network with WebSocket connections only', () => {
|
|
|
67
67
|
const successIds: string[] = []
|
|
68
68
|
nodes.forEach((node) => {
|
|
69
69
|
node.getContentDeliveryManager().on('newMessage', () => {
|
|
70
|
-
successIds.push(
|
|
70
|
+
successIds.push(toNodeId(node.getContentDeliveryManager().getPeerDescriptor()))
|
|
71
71
|
receivedMessageCount += 1
|
|
72
72
|
})
|
|
73
73
|
})
|
|
@@ -75,7 +75,7 @@ describe('Full node network with WebSocket connections only', () => {
|
|
|
75
75
|
const msg = createStreamMessage(
|
|
76
76
|
JSON.stringify({ hello: 'WORLD' }),
|
|
77
77
|
streamPartId,
|
|
78
|
-
|
|
78
|
+
randomUserId()
|
|
79
79
|
)
|
|
80
80
|
entryPoint.getContentDeliveryManager().broadcast(msg)
|
|
81
81
|
await waitForCondition(() => receivedMessageCount === NUM_OF_NODES)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DhtNode, LatencyType, PeerDescriptor, Simulator, SimulatorTransport,
|
|
1
|
+
import { DhtNode, LatencyType, PeerDescriptor, Simulator, SimulatorTransport, toNodeId } from '@streamr/dht'
|
|
2
2
|
import { StreamPartIDUtils, waitForCondition } from '@streamr/utils'
|
|
3
3
|
import { range } from 'lodash'
|
|
4
4
|
import { ContentDeliveryLayerNode } from '../../src/logic/ContentDeliveryLayerNode'
|
|
@@ -98,7 +98,7 @@ describe('ContentDeliveryLayerNode-DhtNode-Latencies', () => {
|
|
|
98
98
|
const neighbor = allNodes.find((node) => {
|
|
99
99
|
return node.getOwnNodeId() === ownNodeId
|
|
100
100
|
})
|
|
101
|
-
const neighborNodeIds = neighbor!.getNeighbors().map((n) =>
|
|
101
|
+
const neighborNodeIds = neighbor!.getNeighbors().map((n) => toNodeId(n))
|
|
102
102
|
expect(neighborNodeIds).toContain(nodeId)
|
|
103
103
|
})
|
|
104
104
|
})
|
|
@@ -122,10 +122,10 @@ describe('ContentDeliveryLayerNode-DhtNode-Latencies', () => {
|
|
|
122
122
|
otherContentDeliveryLayerNodes.forEach((node) => {
|
|
123
123
|
const nodeId = node.getOwnNodeId()
|
|
124
124
|
node.getNeighbors().forEach((neighbor) => {
|
|
125
|
-
const neighborId =
|
|
125
|
+
const neighborId = toNodeId(neighbor)
|
|
126
126
|
if (neighborId !== entryPointContentDeliveryLayerNode.getOwnNodeId()) {
|
|
127
127
|
const neighbor = otherContentDeliveryLayerNodes.find((n) => n.getOwnNodeId() === neighborId)
|
|
128
|
-
const neighborNodeIds = neighbor!.getNeighbors().map((n) =>
|
|
128
|
+
const neighborNodeIds = neighbor!.getNeighbors().map((n) => toNodeId(n))
|
|
129
129
|
if (!neighborNodeIds.includes(nodeId)) {
|
|
130
130
|
mismatchCounter += 1
|
|
131
131
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConnectionManager, DhtNode, PeerDescriptor, Simulator, SimulatorTransport,
|
|
1
|
+
import { ConnectionManager, DhtNode, PeerDescriptor, Simulator, SimulatorTransport, toNodeId, getRandomRegion } from '@streamr/dht'
|
|
2
2
|
import { Logger, StreamPartIDUtils, waitForCondition } from '@streamr/utils'
|
|
3
3
|
import { range } from 'lodash'
|
|
4
4
|
import { ContentDeliveryLayerNode } from '../../src/logic/ContentDeliveryLayerNode'
|
|
@@ -117,7 +117,7 @@ describe('ContentDeliveryLayerNode-DhtNode', () => {
|
|
|
117
117
|
const neighbor = allNodes.find((node) => {
|
|
118
118
|
return node.getOwnNodeId() === nodeId
|
|
119
119
|
})
|
|
120
|
-
const neighborNodeIds = neighbor!.getNeighbors().map((n) =>
|
|
120
|
+
const neighborNodeIds = neighbor!.getNeighbors().map((n) => toNodeId(n))
|
|
121
121
|
expect(neighborNodeIds.includes(allNodes[i].getOwnNodeId())).toEqual(true)
|
|
122
122
|
})
|
|
123
123
|
})
|
|
@@ -145,10 +145,10 @@ describe('ContentDeliveryLayerNode-DhtNode', () => {
|
|
|
145
145
|
otherContentDeliveryLayerNodes.forEach((node) => {
|
|
146
146
|
const nodeId = node.getOwnNodeId()
|
|
147
147
|
node.getNeighbors().forEach((neighbor) => {
|
|
148
|
-
const neighborId =
|
|
148
|
+
const neighborId = toNodeId(neighbor)
|
|
149
149
|
if (neighborId !== entryPointContentDeliveryLayerNode.getOwnNodeId()) {
|
|
150
150
|
const neighbor = otherContentDeliveryLayerNodes.find((n) => n.getOwnNodeId() === neighborId)
|
|
151
|
-
const neighborNodeIds = neighbor!.getNeighbors().map((n) =>
|
|
151
|
+
const neighborNodeIds = neighbor!.getNeighbors().map((n) => toNodeId(n))
|
|
152
152
|
if (!neighborNodeIds.includes(nodeId)) {
|
|
153
153
|
mismatchCounter += 1
|
|
154
154
|
}
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
Simulator,
|
|
4
4
|
SimulatorTransport
|
|
5
5
|
} from '@streamr/dht'
|
|
6
|
-
import {
|
|
7
|
-
import { StreamPartIDUtils, waitForCondition, waitForEvent3 } from '@streamr/utils'
|
|
6
|
+
import { StreamPartIDUtils, waitForCondition, waitForEvent3, wait } from '@streamr/utils'
|
|
8
7
|
import { ContentDeliveryManager, Events } from '../../src/logic/ContentDeliveryManager'
|
|
9
8
|
import { ControlLayerNode } from '../../src/logic/ControlLayerNode'
|
|
10
9
|
import { createMockPeerDescriptor, createStreamMessage } from '../utils/utils'
|
|
10
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
11
11
|
|
|
12
12
|
describe('ContentDeliveryManager', () => {
|
|
13
13
|
|
|
@@ -25,18 +25,12 @@ describe('ContentDeliveryManager', () => {
|
|
|
25
25
|
const msg = createStreamMessage(
|
|
26
26
|
JSON.stringify({ hello: 'WORLD' }),
|
|
27
27
|
STREAM_PART_ID,
|
|
28
|
-
|
|
28
|
+
randomUserId()
|
|
29
29
|
)
|
|
30
|
-
|
|
31
|
-
afterEach(async () => {
|
|
32
|
-
await Promise.all([
|
|
33
|
-
manager1.destroy(),
|
|
34
|
-
manager2.destroy()
|
|
35
|
-
])
|
|
36
|
-
})
|
|
30
|
+
let simulator: Simulator
|
|
37
31
|
|
|
38
32
|
beforeEach(async () => {
|
|
39
|
-
|
|
33
|
+
simulator = new Simulator()
|
|
40
34
|
transport1 = new SimulatorTransport(peerDescriptor1, simulator)
|
|
41
35
|
await transport1.start()
|
|
42
36
|
transport2 = new SimulatorTransport(peerDescriptor2, simulator)
|
|
@@ -62,14 +56,26 @@ describe('ContentDeliveryManager', () => {
|
|
|
62
56
|
controlLayerNode2.joinDht([peerDescriptor1])
|
|
63
57
|
])
|
|
64
58
|
|
|
65
|
-
manager1 = new ContentDeliveryManager({})
|
|
66
|
-
manager2 = new ContentDeliveryManager({})
|
|
59
|
+
manager1 = new ContentDeliveryManager({ neighborUpdateInterval: 100 })
|
|
60
|
+
manager2 = new ContentDeliveryManager({ neighborUpdateInterval: 100 })
|
|
67
61
|
await manager1.start(controlLayerNode1, transport1, transport1)
|
|
68
62
|
manager1.setStreamPartEntryPoints(STREAM_PART_ID, [peerDescriptor1])
|
|
69
63
|
await manager2.start(controlLayerNode2, transport2, transport2)
|
|
70
64
|
manager2.setStreamPartEntryPoints(STREAM_PART_ID, [peerDescriptor1])
|
|
71
65
|
})
|
|
72
66
|
|
|
67
|
+
afterEach(async () => {
|
|
68
|
+
await Promise.all([
|
|
69
|
+
manager1.destroy(),
|
|
70
|
+
manager2.destroy(),
|
|
71
|
+
controlLayerNode1.stop(),
|
|
72
|
+
controlLayerNode2.stop(),
|
|
73
|
+
transport1.stop(),
|
|
74
|
+
transport2.stop()
|
|
75
|
+
])
|
|
76
|
+
simulator.stop()
|
|
77
|
+
})
|
|
78
|
+
|
|
73
79
|
it('starts', async () => {
|
|
74
80
|
expect(manager1.getPeerDescriptor()).toEqual(peerDescriptor1)
|
|
75
81
|
expect(manager2.getPeerDescriptor()).toEqual(peerDescriptor2)
|
|
@@ -112,7 +118,7 @@ describe('ContentDeliveryManager', () => {
|
|
|
112
118
|
const msg2 = createStreamMessage(
|
|
113
119
|
JSON.stringify({ hello: 'WORLD' }),
|
|
114
120
|
streamPartId2,
|
|
115
|
-
|
|
121
|
+
randomUserId()
|
|
116
122
|
)
|
|
117
123
|
await Promise.all([
|
|
118
124
|
waitForEvent3<Events>(manager1, 'newMessage'),
|
|
@@ -133,4 +139,19 @@ describe('ContentDeliveryManager', () => {
|
|
|
133
139
|
await waitForCondition(() => manager1.getNeighbors(STREAM_PART_ID).length === 0)
|
|
134
140
|
})
|
|
135
141
|
|
|
142
|
+
it('RTTs are updated for node info', async () => {
|
|
143
|
+
manager1.joinStreamPart(STREAM_PART_ID)
|
|
144
|
+
manager2.joinStreamPart(STREAM_PART_ID)
|
|
145
|
+
await Promise.all([
|
|
146
|
+
waitForCondition(() => manager1.getNeighbors(STREAM_PART_ID).length === 1),
|
|
147
|
+
waitForCondition(() => manager2.getNeighbors(STREAM_PART_ID).length === 1)
|
|
148
|
+
])
|
|
149
|
+
// Wait for RTTs to be updated
|
|
150
|
+
await wait(500)
|
|
151
|
+
const nodeInfo1 = manager1.getNodeInfo()
|
|
152
|
+
const nodeInfo2 = manager2.getNodeInfo()
|
|
153
|
+
expect(nodeInfo1[0].contentDeliveryLayerNeighbors[0].rtt).toBeGreaterThanOrEqual(0)
|
|
154
|
+
expect(nodeInfo2[0].contentDeliveryLayerNeighbors[0].rtt).toBeGreaterThanOrEqual(0)
|
|
155
|
+
})
|
|
156
|
+
|
|
136
157
|
})
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
Simulator,
|
|
6
6
|
SimulatorTransport
|
|
7
7
|
} from '@streamr/dht'
|
|
8
|
-
import { randomEthereumAddress } from '@streamr/test-utils'
|
|
9
8
|
import { StreamPartIDUtils, waitForCondition } from '@streamr/utils'
|
|
10
9
|
import { ContentDeliveryRpcRemote } from '../../src/logic/ContentDeliveryRpcRemote'
|
|
11
10
|
import { Empty } from '../../src/proto/google/protobuf/empty'
|
|
@@ -15,6 +14,7 @@ import {
|
|
|
15
14
|
} from '../../src/proto/packages/trackerless-network/protos/NetworkRpc'
|
|
16
15
|
import { ContentDeliveryRpcClient } from '../../src/proto/packages/trackerless-network/protos/NetworkRpc.client'
|
|
17
16
|
import { createStreamMessage } from '../utils/utils'
|
|
17
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
18
18
|
|
|
19
19
|
describe('ContentDeliveryRpcRemote', () => {
|
|
20
20
|
let mockServerRpc: ListeningRpcCommunicator
|
|
@@ -85,7 +85,7 @@ describe('ContentDeliveryRpcRemote', () => {
|
|
|
85
85
|
const msg = createStreamMessage(
|
|
86
86
|
JSON.stringify({ hello: 'WORLD' }),
|
|
87
87
|
StreamPartIDUtils.parse('test-stream#0'),
|
|
88
|
-
|
|
88
|
+
randomUserId()
|
|
89
89
|
)
|
|
90
90
|
|
|
91
91
|
await rpcRemote.sendStreamMessage(msg)
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
PeerDescriptor,
|
|
5
5
|
Simulator,
|
|
6
6
|
SimulatorTransport,
|
|
7
|
-
|
|
7
|
+
toNodeId
|
|
8
8
|
} from '@streamr/dht'
|
|
9
9
|
import { StreamPartIDUtils } from '@streamr/utils'
|
|
10
10
|
import { NodeList } from '../../src/logic/NodeList'
|
|
@@ -82,7 +82,7 @@ describe('Handshakes', () => {
|
|
|
82
82
|
rpcCommunicator2 = new ListeningRpcCommunicator(streamPartId, simulatorTransport2)
|
|
83
83
|
rpcCommunicator3 = new ListeningRpcCommunicator(streamPartId, simulatorTransport3)
|
|
84
84
|
|
|
85
|
-
const handshakerNodeId =
|
|
85
|
+
const handshakerNodeId = toNodeId(peerDescriptor2)
|
|
86
86
|
leftNodeView = new NodeList(handshakerNodeId, 10)
|
|
87
87
|
rightNodeView = new NodeList(handshakerNodeId, 10)
|
|
88
88
|
nodeView = new NodeList(handshakerNodeId, 10)
|
|
@@ -124,7 +124,7 @@ describe('Handshakes', () => {
|
|
|
124
124
|
)
|
|
125
125
|
)
|
|
126
126
|
expect(res).toEqual(true)
|
|
127
|
-
expect(neighbors.has(
|
|
127
|
+
expect(neighbors.has(toNodeId(peerDescriptor1))).toEqual(true)
|
|
128
128
|
})
|
|
129
129
|
|
|
130
130
|
it('Handshake accepted', async () => {
|
|
@@ -139,7 +139,7 @@ describe('Handshakes', () => {
|
|
|
139
139
|
)
|
|
140
140
|
)
|
|
141
141
|
expect(res).toEqual(true)
|
|
142
|
-
expect(neighbors.has(
|
|
142
|
+
expect(neighbors.has(toNodeId(peerDescriptor1))).toEqual(true)
|
|
143
143
|
})
|
|
144
144
|
|
|
145
145
|
it('Handshake rejected', async () => {
|
|
@@ -154,7 +154,7 @@ describe('Handshakes', () => {
|
|
|
154
154
|
)
|
|
155
155
|
)
|
|
156
156
|
expect(res).toEqual(false)
|
|
157
|
-
expect(neighbors.has(
|
|
157
|
+
expect(neighbors.has(toNodeId(peerDescriptor1))).toEqual(false)
|
|
158
158
|
})
|
|
159
159
|
|
|
160
160
|
it('Handshake with Interleaving', async () => {
|
|
@@ -170,7 +170,7 @@ describe('Handshakes', () => {
|
|
|
170
170
|
)
|
|
171
171
|
)
|
|
172
172
|
expect(res).toEqual(true)
|
|
173
|
-
expect(neighbors.has(
|
|
174
|
-
expect(neighbors.has(
|
|
173
|
+
expect(neighbors.has(toNodeId(peerDescriptor1))).toEqual(true)
|
|
174
|
+
expect(neighbors.has(toNodeId(peerDescriptor3))).toEqual(true)
|
|
175
175
|
})
|
|
176
176
|
})
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { LatencyType, PeerDescriptor, Simulator, SimulatorTransport } from '@streamr/dht'
|
|
2
|
-
import { randomEthereumAddress } from '@streamr/test-utils'
|
|
3
2
|
import { StreamPartIDUtils } from '@streamr/utils'
|
|
4
3
|
import { range } from 'lodash'
|
|
5
4
|
import { NetworkStack } from '../../src/NetworkStack'
|
|
6
5
|
import { createMockPeerDescriptor, createStreamMessage } from '../utils/utils'
|
|
6
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
7
7
|
|
|
8
8
|
describe('inspect', () => {
|
|
9
9
|
|
|
@@ -72,7 +72,7 @@ describe('inspect', () => {
|
|
|
72
72
|
const msg = createStreamMessage(
|
|
73
73
|
JSON.stringify({ hello: 'WORLD' }),
|
|
74
74
|
streamPartId,
|
|
75
|
-
|
|
75
|
+
randomUserId(),
|
|
76
76
|
123123,
|
|
77
77
|
sequenceNumber
|
|
78
78
|
)
|
|
@@ -3,6 +3,7 @@ import { StreamPartIDUtils, hexToBinary, utf8ToBinary, waitForCondition } from '
|
|
|
3
3
|
import { NetworkNode, createNetworkNode } from '../../src/NetworkNode'
|
|
4
4
|
import { ContentType, EncryptionType, SignatureType, StreamMessage } from '../../src/proto/packages/trackerless-network/protos/NetworkRpc'
|
|
5
5
|
import { createMockPeerDescriptor } from '../utils/utils'
|
|
6
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
6
7
|
|
|
7
8
|
const STREAM_PART_ID = StreamPartIDUtils.parse('test#0')
|
|
8
9
|
|
|
@@ -62,7 +63,7 @@ describe('NetworkNode', () => {
|
|
|
62
63
|
streamPartition: StreamPartIDUtils.getStreamPartition(STREAM_PART_ID),
|
|
63
64
|
timestamp: 666,
|
|
64
65
|
sequenceNumber: 0,
|
|
65
|
-
publisherId: hexToBinary(
|
|
66
|
+
publisherId: hexToBinary(randomUserId()),
|
|
66
67
|
messageChainId: 'msgChainId'
|
|
67
68
|
},
|
|
68
69
|
previousMessageRef: {
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
RpcCommunicator,
|
|
5
5
|
toProtoRpcClient
|
|
6
6
|
} from '@streamr/proto-rpc'
|
|
7
|
-
import { randomEthereumAddress } from '@streamr/test-utils'
|
|
8
7
|
import { StreamPartIDUtils, waitForCondition } from '@streamr/utils'
|
|
9
8
|
import { Empty } from '../../src/proto/google/protobuf/empty'
|
|
10
9
|
import { RpcMessage } from '../../src/proto/packages/proto-rpc/protos/ProtoRpc'
|
|
11
10
|
import { StreamMessage } from '../../src/proto/packages/trackerless-network/protos/NetworkRpc'
|
|
12
11
|
import { ContentDeliveryRpcClient } from '../../src/proto/packages/trackerless-network/protos/NetworkRpc.client'
|
|
13
12
|
import { createStreamMessage } from '../utils/utils'
|
|
13
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
14
14
|
|
|
15
15
|
describe('Network RPC', () => {
|
|
16
16
|
let rpcCommunicator1: RpcCommunicator<DhtCallContext>
|
|
@@ -21,8 +21,8 @@ describe('Network RPC', () => {
|
|
|
21
21
|
beforeEach(() => {
|
|
22
22
|
rpcCommunicator1 = new RpcCommunicator()
|
|
23
23
|
rpcCommunicator2 = new RpcCommunicator()
|
|
24
|
-
rpcCommunicator1.
|
|
25
|
-
rpcCommunicator2.handleIncomingMessage(message)
|
|
24
|
+
rpcCommunicator1.setOutgoingMessageListener(async (message: RpcMessage) => {
|
|
25
|
+
rpcCommunicator2.handleIncomingMessage(message, new DhtCallContext())
|
|
26
26
|
})
|
|
27
27
|
client = toProtoRpcClient(new ContentDeliveryRpcClient(rpcCommunicator1.getRpcClientTransport()))
|
|
28
28
|
rpcCommunicator2.registerRpcNotification(
|
|
@@ -44,7 +44,7 @@ describe('Network RPC', () => {
|
|
|
44
44
|
const msg = createStreamMessage(
|
|
45
45
|
JSON.stringify({ hello: 'WORLD' }),
|
|
46
46
|
StreamPartIDUtils.parse('testStream#0'),
|
|
47
|
-
|
|
47
|
+
randomUserId()
|
|
48
48
|
)
|
|
49
49
|
await client.sendStreamMessage(msg)
|
|
50
50
|
await waitForCondition(() => recvCounter === 1)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { randomEthereumAddress } from '@streamr/test-utils'
|
|
2
1
|
import {
|
|
3
2
|
StreamPartIDUtils,
|
|
4
3
|
waitForCondition
|
|
5
4
|
} from '@streamr/utils'
|
|
6
5
|
import { NetworkStack } from '../../src/NetworkStack'
|
|
7
6
|
import { createMockPeerDescriptor, createStreamMessage } from '../utils/utils'
|
|
7
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
8
8
|
|
|
9
9
|
const STREAM_PART_ID = StreamPartIDUtils.parse('stream#0')
|
|
10
10
|
|
|
@@ -55,7 +55,7 @@ describe('NetworkStack', () => {
|
|
|
55
55
|
const msg = createStreamMessage(
|
|
56
56
|
JSON.stringify({ hello: 'WORLD' }),
|
|
57
57
|
STREAM_PART_ID,
|
|
58
|
-
|
|
58
|
+
randomUserId()
|
|
59
59
|
)
|
|
60
60
|
stack2.getContentDeliveryManager().broadcast(msg)
|
|
61
61
|
await waitForCondition(() => receivedMessages === 1)
|
|
@@ -89,12 +89,16 @@ describe('NetworkStack NodeInfoRpc', () => {
|
|
|
89
89
|
{
|
|
90
90
|
id: streamPartId1,
|
|
91
91
|
controlLayerNeighbors: [normalizePeerDescriptor(otherPeerDescriptor)],
|
|
92
|
-
contentDeliveryLayerNeighbors: [
|
|
92
|
+
contentDeliveryLayerNeighbors: [{
|
|
93
|
+
peerDescriptor: normalizePeerDescriptor(otherPeerDescriptor)
|
|
94
|
+
}]
|
|
93
95
|
},
|
|
94
96
|
{
|
|
95
97
|
id: streamPartId2,
|
|
96
98
|
controlLayerNeighbors: [normalizePeerDescriptor(otherPeerDescriptor)],
|
|
97
|
-
contentDeliveryLayerNeighbors: [
|
|
99
|
+
contentDeliveryLayerNeighbors: [{
|
|
100
|
+
peerDescriptor: normalizePeerDescriptor(otherPeerDescriptor)
|
|
101
|
+
}]
|
|
98
102
|
}
|
|
99
103
|
],
|
|
100
104
|
version: expect.any(String)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Simulator } from '@streamr/dht'
|
|
2
|
-
import { randomEthereumAddress } from '@streamr/test-utils'
|
|
3
2
|
import { StreamPartIDUtils, waitForCondition } from '@streamr/utils'
|
|
4
3
|
import { range } from 'lodash'
|
|
5
4
|
import { ContentDeliveryLayerNode } from '../../src/logic/ContentDeliveryLayerNode'
|
|
6
5
|
import { DiscoveryLayerNode } from '../../src/logic/DiscoveryLayerNode'
|
|
7
6
|
import { createMockContentDeliveryLayerNodeAndDhtNode, createMockPeerDescriptor, createStreamMessage } from '../utils/utils'
|
|
7
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
8
8
|
|
|
9
9
|
describe('Propagation', () => {
|
|
10
10
|
const entryPointDescriptor = createMockPeerDescriptor()
|
|
@@ -68,7 +68,7 @@ describe('Propagation', () => {
|
|
|
68
68
|
const msg = createStreamMessage(
|
|
69
69
|
JSON.stringify({ hello: 'WORLD' }),
|
|
70
70
|
STREAM_PART_ID,
|
|
71
|
-
|
|
71
|
+
randomUserId()
|
|
72
72
|
)
|
|
73
73
|
contentDeliveryLayerNodes[0].broadcast(msg)
|
|
74
74
|
await waitForCondition(() => totalReceived >= NUM_OF_NODES, 10000)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { LatencyType, PeerDescriptor, Simulator, SimulatorTransport } from '@streamr/dht'
|
|
2
|
-
import { randomEthereumAddress } from '@streamr/test-utils'
|
|
3
2
|
import { StreamPartIDUtils, waitForCondition } from '@streamr/utils'
|
|
4
3
|
import { NetworkStack } from '../../src/NetworkStack'
|
|
5
4
|
import { streamPartIdToDataKey } from '../../src/logic/ContentDeliveryManager'
|
|
6
5
|
import { Any } from '../../src/proto/google/protobuf/any'
|
|
7
6
|
import { createMockPeerDescriptor, createStreamMessage } from '../utils/utils'
|
|
7
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
8
8
|
|
|
9
9
|
const STREAM_PART_ID = StreamPartIDUtils.parse('stream#0')
|
|
10
10
|
|
|
@@ -74,7 +74,7 @@ describe('Joining stream parts on offline nodes', () => {
|
|
|
74
74
|
|
|
75
75
|
node1.getContentDeliveryManager().joinStreamPart(STREAM_PART_ID)
|
|
76
76
|
node1.getContentDeliveryManager().on('newMessage', () => { messageReceived = true })
|
|
77
|
-
const msg = createStreamMessage(JSON.stringify({ hello: 'WORLD' }), STREAM_PART_ID,
|
|
77
|
+
const msg = createStreamMessage(JSON.stringify({ hello: 'WORLD' }), STREAM_PART_ID, randomUserId())
|
|
78
78
|
node2.getContentDeliveryManager().broadcast(msg)
|
|
79
79
|
await waitForCondition(() => messageReceived, 40000)
|
|
80
80
|
}, 60000)
|
|
@@ -5,6 +5,7 @@ import { NetworkNode, createNetworkNode } from '../../src/NetworkNode'
|
|
|
5
5
|
import { streamPartIdToDataKey } from '../../src/logic/ContentDeliveryManager'
|
|
6
6
|
import { ContentType, EncryptionType, SignatureType, StreamMessage } from '../../src/proto/packages/trackerless-network/protos/NetworkRpc'
|
|
7
7
|
import { createMockPeerDescriptor } from '../utils/utils'
|
|
8
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
8
9
|
|
|
9
10
|
const STREAM_PART_ID = StreamPartIDUtils.parse('test#0')
|
|
10
11
|
|
|
@@ -21,7 +22,7 @@ describe('stream without default entrypoints', () => {
|
|
|
21
22
|
streamPartition: StreamPartIDUtils.getStreamPartition(STREAM_PART_ID),
|
|
22
23
|
timestamp: 666,
|
|
23
24
|
sequenceNumber: 0,
|
|
24
|
-
publisherId: hexToBinary(
|
|
25
|
+
publisherId: hexToBinary(randomUserId()),
|
|
25
26
|
messageChainId: 'msgChainId'
|
|
26
27
|
},
|
|
27
28
|
previousMessageRef: {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { LatencyType, Simulator, SimulatorTransport } from '@streamr/dht'
|
|
2
|
-
import { randomEthereumAddress } from '@streamr/test-utils'
|
|
3
2
|
import { StreamPartIDUtils, waitForCondition } from '@streamr/utils'
|
|
4
3
|
import { range } from 'lodash'
|
|
5
4
|
import { NetworkStack } from '../../src/NetworkStack'
|
|
6
5
|
import { MAX_NODE_COUNT } from '../../src/logic/PeerDescriptorStoreManager'
|
|
7
6
|
import { createMockPeerDescriptor, createStreamMessage } from '../utils/utils'
|
|
7
|
+
import { randomUserId } from '@streamr/test-utils'
|
|
8
8
|
|
|
9
9
|
describe('Stream Entry Points are replaced when known entry points leave streams', () => {
|
|
10
10
|
|
|
@@ -89,7 +89,7 @@ describe('Stream Entry Points are replaced when known entry points leave streams
|
|
|
89
89
|
const msg = createStreamMessage(
|
|
90
90
|
JSON.stringify({ hello: 'WORLD' }),
|
|
91
91
|
STREAM_PART_ID,
|
|
92
|
-
|
|
92
|
+
randomUserId()
|
|
93
93
|
)
|
|
94
94
|
newNodeInStream.getContentDeliveryManager().broadcast(msg)
|
|
95
95
|
await waitForCondition(() => receivedMessages === NUM_OF_LATER_NODES, 30000)
|