2019-12-06 02:16:18 +00:00
|
|
|
import options, tables
|
|
|
|
import unittest
|
|
|
|
import chronos, chronicles
|
|
|
|
import ../libp2p/[daemon/daemonapi,
|
|
|
|
protobuf/minprotobuf,
|
|
|
|
vbuffer,
|
|
|
|
multiaddress,
|
|
|
|
multicodec,
|
|
|
|
cid,
|
|
|
|
varint,
|
|
|
|
multihash,
|
|
|
|
peer,
|
|
|
|
peerinfo,
|
|
|
|
switch,
|
|
|
|
connection,
|
|
|
|
stream/lpstream,
|
|
|
|
muxers/muxer,
|
|
|
|
crypto/crypto,
|
|
|
|
muxers/mplex/mplex,
|
|
|
|
muxers/muxer,
|
|
|
|
muxers/mplex/types,
|
|
|
|
protocols/protocol,
|
|
|
|
protocols/identify,
|
|
|
|
transports/transport,
|
|
|
|
transports/tcptransport,
|
|
|
|
protocols/secure/secure,
|
|
|
|
protocols/secure/secio,
|
|
|
|
protocols/pubsub/pubsub,
|
|
|
|
protocols/pubsub/gossipsub,
|
|
|
|
protocols/pubsub/floodsub]
|
|
|
|
|
|
|
|
type
|
|
|
|
# TODO: Unify both PeerInfo structs
|
|
|
|
NativePeerInfo = peerinfo.PeerInfo
|
|
|
|
DaemonPeerInfo = daemonapi.PeerInfo
|
|
|
|
|
|
|
|
proc writeLp*(s: StreamTransport, msg: string | seq[byte]): Future[int] {.gcsafe.} =
|
|
|
|
## write lenght prefixed
|
|
|
|
var buf = initVBuffer()
|
|
|
|
buf.writeSeq(msg)
|
|
|
|
buf.finish()
|
|
|
|
result = s.write(buf.buffer)
|
|
|
|
|
|
|
|
proc readLp*(s: StreamTransport): Future[seq[byte]] {.async, gcsafe.} =
|
|
|
|
## read lenght prefixed msg
|
|
|
|
var
|
|
|
|
size: uint
|
|
|
|
length: int
|
|
|
|
res: VarintStatus
|
|
|
|
result = newSeq[byte](10)
|
2020-05-07 20:37:46 +00:00
|
|
|
|
|
|
|
for i in 0..<len(result):
|
|
|
|
await s.readExactly(addr result[i], 1)
|
|
|
|
res = LP.getUVarint(result.toOpenArray(0, i), length, size)
|
|
|
|
if res == VarintStatus.Success:
|
|
|
|
break
|
|
|
|
if res != VarintStatus.Success:
|
2020-05-08 20:58:23 +00:00
|
|
|
raise (ref InvalidVarintError)()
|
2020-05-07 20:37:46 +00:00
|
|
|
result.setLen(size)
|
|
|
|
if size > 0.uint:
|
|
|
|
await s.readExactly(addr result[0], int(size))
|
2019-12-06 02:16:18 +00:00
|
|
|
|
2019-12-10 20:50:35 +00:00
|
|
|
proc createNode*(privKey: Option[PrivateKey] = none(PrivateKey),
|
2019-12-06 02:16:18 +00:00
|
|
|
address: string = "/ip4/127.0.0.1/tcp/0",
|
|
|
|
triggerSelf: bool = false,
|
|
|
|
gossip: bool = false): Switch =
|
|
|
|
var seckey = privKey
|
|
|
|
if privKey.isNone:
|
2020-05-18 05:25:55 +00:00
|
|
|
seckey = some(PrivateKey.random(RSA).get())
|
2019-12-06 02:16:18 +00:00
|
|
|
|
2020-02-11 17:53:39 +00:00
|
|
|
var peerInfo = NativePeerInfo.init(seckey.get(), [Multiaddress.init(address)])
|
2019-12-06 02:16:18 +00:00
|
|
|
proc createMplex(conn: Connection): Muxer = newMplex(conn)
|
|
|
|
let mplexProvider = newMuxerProvider(createMplex, MplexCodec)
|
|
|
|
let transports = @[Transport(newTransport(TcpTransport))]
|
|
|
|
let muxers = [(MplexCodec, mplexProvider)].toTable()
|
|
|
|
let identify = newIdentify(peerInfo)
|
|
|
|
let secureManagers = [(SecioCodec, Secure(newSecio(seckey.get())))].toTable()
|
2019-12-10 20:50:35 +00:00
|
|
|
|
2019-12-06 02:16:18 +00:00
|
|
|
var pubSub: Option[PubSub]
|
|
|
|
if gossip:
|
|
|
|
pubSub = some(PubSub(newPubSub(GossipSub, peerInfo, triggerSelf)))
|
|
|
|
else:
|
|
|
|
pubSub = some(PubSub(newPubSub(FloodSub, peerInfo, triggerSelf)))
|
|
|
|
|
|
|
|
result = newSwitch(peerInfo,
|
|
|
|
transports,
|
|
|
|
identify,
|
|
|
|
muxers,
|
|
|
|
secureManagers = secureManagers,
|
|
|
|
pubSub = pubSub)
|
|
|
|
|
2020-02-21 01:14:39 +00:00
|
|
|
proc testPubSubDaemonPublish(gossip: bool = false,
|
|
|
|
count: int = 1): Future[bool] {.async.} =
|
2019-12-06 02:16:18 +00:00
|
|
|
var pubsubData = "TEST MESSAGE"
|
|
|
|
var testTopic = "test-topic"
|
|
|
|
var msgData = cast[seq[byte]](pubsubData)
|
|
|
|
|
|
|
|
var flags = {PSFloodSub}
|
|
|
|
if gossip:
|
|
|
|
flags = {PSGossipSub}
|
|
|
|
|
|
|
|
let daemonNode = await newDaemonApi(flags)
|
|
|
|
let daemonPeer = await daemonNode.identity()
|
|
|
|
let nativeNode = createNode(gossip = gossip)
|
|
|
|
let awaiters = nativeNode.start()
|
|
|
|
let nativePeer = nativeNode.peerInfo
|
|
|
|
|
2020-05-15 03:56:56 +00:00
|
|
|
var finished = false
|
2019-12-23 18:45:12 +00:00
|
|
|
var times = 0
|
2019-12-06 02:16:18 +00:00
|
|
|
proc nativeHandler(topic: string, data: seq[byte]) {.async.} =
|
|
|
|
let smsg = cast[string](data)
|
|
|
|
check smsg == pubsubData
|
2019-12-23 18:45:12 +00:00
|
|
|
times.inc()
|
2020-05-15 03:56:56 +00:00
|
|
|
if times >= count and not finished:
|
|
|
|
finished = true
|
2019-12-06 02:16:18 +00:00
|
|
|
|
2020-02-25 22:13:05 +00:00
|
|
|
await nativeNode.connect(NativePeerInfo.init(daemonPeer.peer,
|
|
|
|
daemonPeer.addresses))
|
2019-12-06 02:16:18 +00:00
|
|
|
await sleepAsync(1.seconds)
|
2019-12-07 16:36:39 +00:00
|
|
|
await daemonNode.connect(nativePeer.peerId, nativePeer.addrs)
|
2019-12-10 20:50:35 +00:00
|
|
|
|
2019-12-06 02:16:18 +00:00
|
|
|
proc pubsubHandler(api: DaemonAPI,
|
|
|
|
ticket: PubsubTicket,
|
2019-12-10 20:50:35 +00:00
|
|
|
message: PubSubMessage): Future[bool] {.async.} =
|
2019-12-06 02:16:18 +00:00
|
|
|
result = true # don't cancel subscription
|
|
|
|
|
|
|
|
asyncDiscard daemonNode.pubsubSubscribe(testTopic, pubsubHandler)
|
|
|
|
await nativeNode.subscribe(testTopic, nativeHandler)
|
2020-05-15 03:56:56 +00:00
|
|
|
await sleepAsync(1.seconds)
|
|
|
|
|
|
|
|
proc publisher() {.async.} =
|
|
|
|
while not finished:
|
|
|
|
await daemonNode.pubsubPublish(testTopic, msgData)
|
|
|
|
await sleepAsync(100.millis)
|
|
|
|
|
2020-05-18 13:49:49 +00:00
|
|
|
await wait(publisher(), 5.minutes) # should be plenty of time
|
2019-12-06 02:16:18 +00:00
|
|
|
|
2020-05-15 03:56:56 +00:00
|
|
|
result = true
|
2019-12-06 02:16:18 +00:00
|
|
|
await nativeNode.stop()
|
|
|
|
await allFutures(awaiters)
|
|
|
|
await daemonNode.close()
|
|
|
|
|
2020-02-21 01:14:39 +00:00
|
|
|
proc testPubSubNodePublish(gossip: bool = false,
|
|
|
|
count: int = 1): Future[bool] {.async.} =
|
2019-12-06 02:16:18 +00:00
|
|
|
var pubsubData = "TEST MESSAGE"
|
|
|
|
var testTopic = "test-topic"
|
|
|
|
var msgData = cast[seq[byte]](pubsubData)
|
|
|
|
|
|
|
|
var flags = {PSFloodSub}
|
|
|
|
if gossip:
|
|
|
|
flags = {PSGossipSub}
|
|
|
|
|
|
|
|
let daemonNode = await newDaemonApi(flags)
|
|
|
|
let daemonPeer = await daemonNode.identity()
|
|
|
|
let nativeNode = createNode(gossip = gossip)
|
|
|
|
let awaiters = nativeNode.start()
|
|
|
|
let nativePeer = nativeNode.peerInfo
|
|
|
|
|
2020-02-25 22:13:05 +00:00
|
|
|
await nativeNode.connect(NativePeerInfo.init(daemonPeer.peer,
|
|
|
|
daemonPeer.addresses))
|
2019-12-06 02:16:18 +00:00
|
|
|
|
|
|
|
await sleepAsync(1.seconds)
|
2019-12-07 16:36:39 +00:00
|
|
|
await daemonNode.connect(nativePeer.peerId, nativePeer.addrs)
|
2019-12-10 20:50:35 +00:00
|
|
|
|
2019-12-23 18:45:12 +00:00
|
|
|
var times = 0
|
2020-05-15 03:56:56 +00:00
|
|
|
var finished = false
|
2019-12-06 02:16:18 +00:00
|
|
|
proc pubsubHandler(api: DaemonAPI,
|
|
|
|
ticket: PubsubTicket,
|
2019-12-10 20:50:35 +00:00
|
|
|
message: PubSubMessage): Future[bool] {.async.} =
|
2019-12-06 02:16:18 +00:00
|
|
|
let smsg = cast[string](message.data)
|
|
|
|
check smsg == pubsubData
|
2019-12-23 18:45:12 +00:00
|
|
|
times.inc()
|
2020-05-15 03:56:56 +00:00
|
|
|
if times >= count and not finished:
|
|
|
|
finished = true
|
2019-12-06 02:16:18 +00:00
|
|
|
result = true # don't cancel subscription
|
|
|
|
|
2019-12-23 18:45:12 +00:00
|
|
|
discard await daemonNode.pubsubSubscribe(testTopic, pubsubHandler)
|
|
|
|
proc nativeHandler(topic: string, data: seq[byte]) {.async.} = discard
|
|
|
|
await nativeNode.subscribe(testTopic, nativeHandler)
|
2019-12-06 02:16:18 +00:00
|
|
|
await sleepAsync(1.seconds)
|
|
|
|
|
2020-05-15 03:56:56 +00:00
|
|
|
proc publisher() {.async.} =
|
|
|
|
while not finished:
|
|
|
|
await nativeNode.publish(testTopic, msgData)
|
|
|
|
await sleepAsync(100.millis)
|
|
|
|
|
2020-05-18 13:49:49 +00:00
|
|
|
await wait(publisher(), 5.minutes) # should be plenty of time
|
2020-05-15 03:56:56 +00:00
|
|
|
|
|
|
|
result = finished
|
2019-12-06 02:16:18 +00:00
|
|
|
await nativeNode.stop()
|
|
|
|
await allFutures(awaiters)
|
|
|
|
await daemonNode.close()
|
|
|
|
|
|
|
|
suite "Interop":
|
|
|
|
test "native -> daemon multiple reads and writes":
|
|
|
|
proc runTests(): Future[bool] {.async.} =
|
|
|
|
var protos = @["/test-stream"]
|
|
|
|
|
|
|
|
let nativeNode = createNode()
|
|
|
|
let awaiters = await nativeNode.start()
|
|
|
|
let daemonNode = await newDaemonApi()
|
|
|
|
let daemonPeer = await daemonNode.identity()
|
|
|
|
|
|
|
|
var testFuture = newFuture[void]("test.future")
|
|
|
|
proc daemonHandler(api: DaemonAPI, stream: P2PStream) {.async.} =
|
|
|
|
check cast[string](await stream.transp.readLp()) == "test 1"
|
|
|
|
asyncDiscard stream.transp.writeLp("test 2")
|
2019-12-10 20:50:35 +00:00
|
|
|
|
2019-12-06 02:16:18 +00:00
|
|
|
await sleepAsync(10.millis)
|
|
|
|
check cast[string](await stream.transp.readLp()) == "test 3"
|
|
|
|
asyncDiscard stream.transp.writeLp("test 4")
|
|
|
|
testFuture.complete()
|
|
|
|
|
|
|
|
await daemonNode.addHandler(protos, daemonHandler)
|
2019-12-07 16:36:39 +00:00
|
|
|
let conn = await nativeNode.dial(NativePeerInfo.init(daemonPeer.peer,
|
|
|
|
daemonPeer.addresses),
|
|
|
|
protos[0])
|
2019-12-06 02:16:18 +00:00
|
|
|
await conn.writeLp("test 1")
|
2020-05-08 20:58:23 +00:00
|
|
|
check "test 2" == cast[string]((await conn.readLp(1024)))
|
2019-12-06 02:16:18 +00:00
|
|
|
await sleepAsync(10.millis)
|
|
|
|
|
|
|
|
await conn.writeLp("test 3")
|
2020-05-08 20:58:23 +00:00
|
|
|
check "test 4" == cast[string]((await conn.readLp(1024)))
|
2019-12-06 02:16:18 +00:00
|
|
|
|
|
|
|
await wait(testFuture, 10.secs)
|
|
|
|
await nativeNode.stop()
|
|
|
|
await allFutures(awaiters)
|
|
|
|
await daemonNode.close()
|
|
|
|
result = true
|
|
|
|
|
|
|
|
check:
|
|
|
|
waitFor(runTests()) == true
|
|
|
|
|
|
|
|
test "native -> daemon connection":
|
|
|
|
proc runTests(): Future[bool] {.async.} =
|
|
|
|
var protos = @["/test-stream"]
|
|
|
|
var test = "TEST STRING"
|
2020-03-06 19:19:43 +00:00
|
|
|
# We are preparing expect string, which should be prefixed with varint
|
|
|
|
# length and do not have `\r\n` suffix, because we going to use
|
|
|
|
# readLine().
|
|
|
|
var buffer = initVBuffer()
|
|
|
|
buffer.writeSeq(test & "\r\n")
|
|
|
|
buffer.finish()
|
|
|
|
var expect = newString(len(buffer) - 2)
|
|
|
|
copyMem(addr expect[0], addr buffer.buffer[0], len(expect))
|
2019-12-06 02:16:18 +00:00
|
|
|
|
|
|
|
let nativeNode = createNode()
|
|
|
|
let awaiters = await nativeNode.start()
|
|
|
|
|
|
|
|
let daemonNode = await newDaemonApi()
|
|
|
|
let daemonPeer = await daemonNode.identity()
|
|
|
|
|
|
|
|
var testFuture = newFuture[string]("test.future")
|
|
|
|
proc daemonHandler(api: DaemonAPI, stream: P2PStream) {.async.} =
|
2020-03-06 19:19:43 +00:00
|
|
|
# We should perform `readLp()` instead of `readLine()`. `readLine()`
|
|
|
|
# here reads actually length prefixed string.
|
2019-12-06 02:16:18 +00:00
|
|
|
var line = await stream.transp.readLine()
|
2020-03-06 19:19:43 +00:00
|
|
|
check line == expect
|
2019-12-06 02:16:18 +00:00
|
|
|
testFuture.complete(line)
|
|
|
|
|
|
|
|
await daemonNode.addHandler(protos, daemonHandler)
|
2019-12-07 16:36:39 +00:00
|
|
|
let conn = await nativeNode.dial(NativePeerInfo.init(daemonPeer.peer,
|
|
|
|
daemonPeer.addresses),
|
|
|
|
protos[0])
|
2019-12-06 02:16:18 +00:00
|
|
|
await conn.writeLp(test & "\r\n")
|
2020-03-06 19:19:43 +00:00
|
|
|
result = expect == (await wait(testFuture, 10.secs))
|
2019-12-06 02:16:18 +00:00
|
|
|
await nativeNode.stop()
|
|
|
|
await allFutures(awaiters)
|
|
|
|
await daemonNode.close()
|
|
|
|
|
|
|
|
check:
|
|
|
|
waitFor(runTests()) == true
|
|
|
|
|
|
|
|
test "daemon -> native connection":
|
|
|
|
proc runTests(): Future[bool] {.async.} =
|
|
|
|
var protos = @["/test-stream"]
|
|
|
|
var test = "TEST STRING"
|
|
|
|
|
|
|
|
var testFuture = newFuture[string]("test.future")
|
|
|
|
proc nativeHandler(conn: Connection, proto: string) {.async.} =
|
2020-05-08 20:58:23 +00:00
|
|
|
var line = cast[string](await conn.readLp(1024))
|
2019-12-06 02:16:18 +00:00
|
|
|
check line == test
|
|
|
|
testFuture.complete(line)
|
|
|
|
await conn.close()
|
|
|
|
|
|
|
|
# custom proto
|
|
|
|
var proto = new LPProtocol
|
|
|
|
proto.handler = nativeHandler
|
|
|
|
proto.codec = protos[0] # codec
|
|
|
|
|
|
|
|
let nativeNode = createNode()
|
|
|
|
nativeNode.mount(proto)
|
|
|
|
|
|
|
|
let awaiters = await nativeNode.start()
|
|
|
|
let nativePeer = nativeNode.peerInfo
|
|
|
|
|
|
|
|
let daemonNode = await newDaemonApi()
|
2019-12-07 16:36:39 +00:00
|
|
|
await daemonNode.connect(nativePeer.peerId, nativePeer.addrs)
|
|
|
|
var stream = await daemonNode.openStream(nativePeer.peerId, protos)
|
2019-12-06 02:16:18 +00:00
|
|
|
discard await stream.transp.writeLp(test)
|
|
|
|
|
|
|
|
result = test == (await wait(testFuture, 10.secs))
|
|
|
|
await nativeNode.stop()
|
|
|
|
await allFutures(awaiters)
|
|
|
|
await daemonNode.close()
|
|
|
|
|
|
|
|
check:
|
|
|
|
waitFor(runTests()) == true
|
|
|
|
|
|
|
|
test "daemon -> multiple reads and writes":
|
|
|
|
proc runTests(): Future[bool] {.async.} =
|
|
|
|
var protos = @["/test-stream"]
|
|
|
|
|
|
|
|
var testFuture = newFuture[void]("test.future")
|
|
|
|
proc nativeHandler(conn: Connection, proto: string) {.async.} =
|
2020-05-08 20:58:23 +00:00
|
|
|
check "test 1" == cast[string](await conn.readLp(1024))
|
2019-12-06 02:16:18 +00:00
|
|
|
await conn.writeLp(cast[seq[byte]]("test 2"))
|
|
|
|
|
2020-05-08 20:58:23 +00:00
|
|
|
check "test 3" == cast[string](await conn.readLp(1024))
|
2019-12-06 02:16:18 +00:00
|
|
|
await conn.writeLp(cast[seq[byte]]("test 4"))
|
|
|
|
|
|
|
|
testFuture.complete()
|
|
|
|
await conn.close()
|
|
|
|
|
|
|
|
# custom proto
|
|
|
|
var proto = new LPProtocol
|
|
|
|
proto.handler = nativeHandler
|
|
|
|
proto.codec = protos[0] # codec
|
|
|
|
|
|
|
|
let nativeNode = createNode()
|
|
|
|
nativeNode.mount(proto)
|
|
|
|
|
|
|
|
let awaiters = await nativeNode.start()
|
|
|
|
let nativePeer = nativeNode.peerInfo
|
|
|
|
|
|
|
|
let daemonNode = await newDaemonApi()
|
2019-12-07 16:36:39 +00:00
|
|
|
await daemonNode.connect(nativePeer.peerId, nativePeer.addrs)
|
|
|
|
var stream = await daemonNode.openStream(nativePeer.peerId, protos)
|
2019-12-06 02:16:18 +00:00
|
|
|
|
|
|
|
asyncDiscard stream.transp.writeLp("test 1")
|
|
|
|
check "test 2" == cast[string](await stream.transp.readLp())
|
|
|
|
|
|
|
|
asyncDiscard stream.transp.writeLp("test 3")
|
|
|
|
check "test 4" == cast[string](await stream.transp.readLp())
|
|
|
|
|
|
|
|
await wait(testFuture, 10.secs)
|
|
|
|
|
|
|
|
result = true
|
|
|
|
await nativeNode.stop()
|
|
|
|
await allFutures(awaiters)
|
|
|
|
await daemonNode.close()
|
|
|
|
|
|
|
|
check:
|
|
|
|
waitFor(runTests()) == true
|
|
|
|
|
|
|
|
test "read write multiple":
|
|
|
|
proc runTests(): Future[bool] {.async.} =
|
|
|
|
var protos = @["/test-stream"]
|
|
|
|
var test = "TEST STRING"
|
|
|
|
|
|
|
|
var count = 0
|
|
|
|
var testFuture = newFuture[int]("test.future")
|
|
|
|
proc nativeHandler(conn: Connection, proto: string) {.async.} =
|
|
|
|
while count < 10:
|
2020-05-08 20:58:23 +00:00
|
|
|
var line = cast[string](await conn.readLp(1024))
|
2019-12-06 02:16:18 +00:00
|
|
|
check line == test
|
|
|
|
await conn.writeLp(cast[seq[byte]](test))
|
|
|
|
count.inc()
|
|
|
|
|
|
|
|
testFuture.complete(count)
|
|
|
|
await conn.close()
|
|
|
|
|
|
|
|
# custom proto
|
|
|
|
var proto = new LPProtocol
|
|
|
|
proto.handler = nativeHandler
|
|
|
|
proto.codec = protos[0] # codec
|
|
|
|
|
|
|
|
let nativeNode = createNode()
|
|
|
|
nativeNode.mount(proto)
|
|
|
|
|
|
|
|
let awaiters = await nativeNode.start()
|
|
|
|
let nativePeer = nativeNode.peerInfo
|
|
|
|
|
|
|
|
let daemonNode = await newDaemonApi()
|
2019-12-07 16:36:39 +00:00
|
|
|
await daemonNode.connect(nativePeer.peerId, nativePeer.addrs)
|
|
|
|
var stream = await daemonNode.openStream(nativePeer.peerId, protos)
|
2019-12-06 02:16:18 +00:00
|
|
|
|
2020-03-27 16:02:14 +00:00
|
|
|
var count2 = 0
|
|
|
|
while count2 < 10:
|
2019-12-06 02:16:18 +00:00
|
|
|
discard await stream.transp.writeLp(test)
|
|
|
|
let line = await stream.transp.readLp()
|
|
|
|
check test == cast[string](line)
|
2020-03-27 16:02:14 +00:00
|
|
|
inc(count2)
|
2019-12-06 02:16:18 +00:00
|
|
|
|
2020-05-15 03:56:56 +00:00
|
|
|
result = 10 == (await wait(testFuture, 1.minutes))
|
2020-03-29 14:28:48 +00:00
|
|
|
await stream.close()
|
2019-12-06 02:16:18 +00:00
|
|
|
await nativeNode.stop()
|
|
|
|
await allFutures(awaiters)
|
|
|
|
await daemonNode.close()
|
|
|
|
|
|
|
|
check:
|
|
|
|
waitFor(runTests()) == true
|
|
|
|
|
2019-12-23 18:45:12 +00:00
|
|
|
test "floodsub: daemon publish one":
|
2019-12-06 02:16:18 +00:00
|
|
|
check:
|
|
|
|
waitFor(testPubSubDaemonPublish()) == true
|
|
|
|
|
2019-12-23 18:45:12 +00:00
|
|
|
test "floodsub: daemon publish many":
|
2019-12-06 02:16:18 +00:00
|
|
|
check:
|
2019-12-23 18:45:12 +00:00
|
|
|
waitFor(testPubSubDaemonPublish(count = 10)) == true
|
2019-12-06 02:16:18 +00:00
|
|
|
|
2019-12-23 18:45:12 +00:00
|
|
|
test "gossipsub: daemon publish one":
|
|
|
|
check:
|
|
|
|
waitFor(testPubSubDaemonPublish(gossip = true)) == true
|
|
|
|
|
|
|
|
test "gossipsub: daemon publish many":
|
|
|
|
check:
|
|
|
|
waitFor(testPubSubDaemonPublish(gossip = true, count = 10)) == true
|
|
|
|
|
|
|
|
test "floodsub: node publish one":
|
2019-12-06 02:16:18 +00:00
|
|
|
check:
|
|
|
|
waitFor(testPubSubNodePublish()) == true
|
|
|
|
|
2019-12-23 18:45:12 +00:00
|
|
|
test "floodsub: node publish many":
|
|
|
|
check:
|
|
|
|
waitFor(testPubSubNodePublish(count = 10)) == true
|
|
|
|
|
|
|
|
test "gossipsub: node publish one":
|
|
|
|
check:
|
|
|
|
waitFor(testPubSubNodePublish(gossip = true)) == true
|
|
|
|
|
|
|
|
test "gossipsub: node publish many":
|
2019-12-06 02:16:18 +00:00
|
|
|
check:
|
2019-12-23 18:45:12 +00:00
|
|
|
waitFor(testPubSubNodePublish(gossip = true, count = 10)) == true
|