Fix compile failure + CI endless example run (#126)

This commit is contained in:
Kim De Mey 2020-09-01 15:43:06 +02:00 committed by GitHub
parent e8d3156571
commit fd2bb36b15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 36 deletions

View File

@ -1,20 +1,10 @@
{.used.}
import unittest, options, tables, sets, sequtils import
import chronos, chronicles std/[unittest, options, sets],
import utils, chronos, chronicles,
libp2p/errors, utils,
libp2p/switch, ../../waku/protocol/v2/waku_filter, ../test_helpers
libp2p/protobuf/minprotobuf,
libp2p/stream/[bufferstream, connection],
libp2p/crypto/crypto,
libp2p/protocols/pubsub/floodsub,
libp2p/protocols/pubsub/rpc/message,
libp2p/multistream,
libp2p/transports/transport,
libp2p/transports/tcptransport
import ../../waku/protocol/v2/[waku_protocol2, waku_filter, filter]
import ../test_helpers
procSuite "Waku Filter": procSuite "Waku Filter":

View File

@ -67,4 +67,3 @@ task wakusim2, "Build Experimental Waku simulation tools":
task wakuexample2, "Build example Waku usage": task wakuexample2, "Build example Waku usage":
let name = "basic2" let name = "basic2"
buildBinary name, "examples/v2/", "-d:chronicles_log_level=DEBUG" buildBinary name, "examples/v2/", "-d:chronicles_log_level=DEBUG"
exec "build/" & name

View File

@ -1,19 +1,14 @@
import chronos, chronicles import
import ./filter std/tables,
import tables chronos, chronicles, metrics, stew/results,
import libp2p/protocols/pubsub/pubsub, libp2p/protocols/pubsub/pubsubpeer,
libp2p/protocols/pubsub/pubsubpeer, libp2p/protocols/pubsub/floodsub,
libp2p/protocols/pubsub/floodsub, libp2p/protocols/pubsub/gossipsub,
libp2p/protocols/pubsub/gossipsub, libp2p/protocols/pubsub/rpc/[messages, protobuf],
libp2p/protocols/pubsub/rpc/[messages, protobuf], libp2p/protocols/protocol,
libp2p/protocols/protocol, libp2p/protobuf/minprotobuf,
libp2p/protobuf/minprotobuf, libp2p/stream/connection,
libp2p/stream/connection ./filter
import metrics
import stew/results
# NOTE This is just a start, the design of this protocol isn't done yet. It # NOTE This is just a start, the design of this protocol isn't done yet. It
# should be direct payload exchange (a la req-resp), not be coupled with the # should be direct payload exchange (a la req-resp), not be coupled with the
@ -36,13 +31,13 @@ type
WakuFilter* = ref object of LPProtocol WakuFilter* = ref object of LPProtocol
subscribers*: seq[Subscriber] subscribers*: seq[Subscriber]
method encode*(filter: ContentFilter): ProtoBuffer = proc encode*(filter: ContentFilter): ProtoBuffer =
result = initProtoBuffer() result = initProtoBuffer()
for topic in filter.topics: for topic in filter.topics:
result.write(1, topic) result.write(1, topic)
method encode*(rpc: FilterRPC): ProtoBuffer = proc encode*(rpc: FilterRPC): ProtoBuffer =
result = initProtoBuffer() result = initProtoBuffer()
for filter in rpc.filters: for filter in rpc.filters:
@ -68,7 +63,7 @@ proc init*(T: type FilterRPC, buffer: seq[byte]): ProtoResult[T] =
ok(rpc) ok(rpc)
method init*(T: type WakuFilter): T = proc init*(T: type WakuFilter): T =
var ws = WakuFilter(subscribers: newSeq[Subscriber](0)) var ws = WakuFilter(subscribers: newSeq[Subscriber](0))
# From my understanding we need to set up filters, # From my understanding we need to set up filters,