@@ -24,19 +24,12 @@ asyncchecksuite "NetworkStore engine - 2 nodes":
2424 pendingBlocks1, pendingBlocks2: seq [BlockHandle ]
2525
2626 setup:
27- blocks1 = await makeRandomBlocks (datasetSize = 2048 , blockSize = 256 'nb )
28- blocks2 = await makeRandomBlocks (datasetSize = 2048 , blockSize = 256 'nb )
27+ blocks1 = makeRandomBlocks (nBlocks = 8 , blockSize = 256 'nb )
28+ blocks2 = makeRandomBlocks (nBlocks = 8 , blockSize = 256 'nb )
2929 nodeCmps1 = generateNodes (1 , blocks1)[0 ]
3030 nodeCmps2 = generateNodes (1 , blocks2)[0 ]
3131
32- await allFuturesThrowing (
33- nodeCmps1.switch.start (),
34- nodeCmps1.blockDiscovery.start (),
35- nodeCmps1.engine.start (),
36- nodeCmps2.switch.start (),
37- nodeCmps2.blockDiscovery.start (),
38- nodeCmps2.engine.start (),
39- )
32+ await allFuturesThrowing (nodeCmps1.start (), nodeCmps2.start ())
4033
4134 # initialize our want lists
4235 pendingBlocks1 =
@@ -65,14 +58,7 @@ asyncchecksuite "NetworkStore engine - 2 nodes":
6558 check isNil (peerCtx2).not
6659
6760 teardown:
68- await allFuturesThrowing (
69- nodeCmps1.blockDiscovery.stop (),
70- nodeCmps1.engine.stop (),
71- nodeCmps1.switch.stop (),
72- nodeCmps2.blockDiscovery.stop (),
73- nodeCmps2.engine.stop (),
74- nodeCmps2.switch.stop (),
75- )
61+ await allFuturesThrowing (nodeCmps1.stop (), nodeCmps2.stop ())
7662
7763 test " Should exchange blocks on connect" :
7864 await allFuturesThrowing (allFinished (pendingBlocks1)).wait (10 .seconds)
@@ -145,7 +131,7 @@ asyncchecksuite "NetworkStore - multiple nodes":
145131 blocks: seq [bt.Block ]
146132
147133 setup:
148- blocks = await makeRandomBlocks (datasetSize = 4096 , blockSize = 256 'nb )
134+ blocks = makeRandomBlocks (nBlocks = 16 , blockSize = 256 'nb )
149135 nodes = generateNodes (5 )
150136 for e in nodes:
151137 await e.engine.start ()
@@ -203,3 +189,28 @@ asyncchecksuite "NetworkStore - multiple nodes":
203189
204190 check pendingBlocks1.mapIt (it.read) == blocks[0 .. 3 ]
205191 check pendingBlocks2.mapIt (it.read) == blocks[12 .. 15 ]
192+
193+ asyncchecksuite " NetworkStore - dissemination" :
194+ var nodes: seq [NodesComponents ]
195+
196+ teardown:
197+ if nodes.len > 0 :
198+ await nodes.stop ()
199+
200+ test " Should disseminate blocks across large diameter swarm" :
201+ let dataset = makeRandomDataset (nBlocks = 60 , blockSize = 256 'nb ).tryGet ()
202+
203+ nodes = generateNodes (6 , enableDiscovery = false )
204+
205+ await assignBlocks (nodes[0 ], dataset, 0 .. 9 )
206+ await assignBlocks (nodes[1 ], dataset, 10 .. 19 )
207+ await assignBlocks (nodes[2 ], dataset, 20 .. 29 )
208+ await assignBlocks (nodes[3 ], dataset, 30 .. 39 )
209+ await assignBlocks (nodes[4 ], dataset, 40 .. 49 )
210+ await assignBlocks (nodes[5 ], dataset, 50 .. 59 )
211+
212+ await nodes.start ()
213+ await nodes.linearTopology ()
214+
215+ let downloads = nodes.mapIt (downloadDataset (it, dataset))
216+ await allFuturesThrowing (downloads).wait (20 .seconds)
0 commit comments