mirror of https://github.com/waku-org/nwaku.git
various fixes
This commit is contained in:
parent
01df8386b1
commit
cf89b59cbf
19
Makefile
19
Makefile
|
@ -84,7 +84,6 @@ endif
|
|||
endif
|
||||
## end of Heaptracker options
|
||||
|
||||
|
||||
##################
|
||||
## Dependencies ##
|
||||
##################
|
||||
|
@ -196,7 +195,7 @@ wakunode2: | build deps librln negentropy
|
|||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim wakunode2 $(NIM_PARAMS) waku.nims
|
||||
|
||||
benchmarks: | build deps librln
|
||||
benchmarks: | build deps librln negentropy
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim benchmarks $(NIM_PARAMS) waku.nims
|
||||
|
||||
|
@ -204,23 +203,23 @@ testwakunode2: | build deps librln negentropy
|
|||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim testwakunode2 $(NIM_PARAMS) waku.nims
|
||||
|
||||
example2: | build deps librln
|
||||
example2: | build deps librln negentropy
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim example2 $(NIM_PARAMS) waku.nims
|
||||
|
||||
chat2: | build deps librln
|
||||
chat2: | build deps librln negentropy
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim chat2 $(NIM_PARAMS) waku.nims
|
||||
|
||||
rln-db-inspector: | build deps librln
|
||||
rln-db-inspector: | build deps librln negentropy
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim rln_db_inspector $(NIM_PARAMS) waku.nims
|
||||
|
||||
chat2bridge: | build deps librln
|
||||
chat2bridge: | build deps librln negentropy
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim chat2bridge $(NIM_PARAMS) waku.nims
|
||||
|
||||
liteprotocoltester: | build deps librln
|
||||
liteprotocoltester: | build deps librln negentropy
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim liteprotocoltester $(NIM_PARAMS) waku.nims
|
||||
|
||||
|
@ -232,11 +231,11 @@ liteprotocoltester: | build deps librln
|
|||
|
||||
tools: networkmonitor wakucanary
|
||||
|
||||
wakucanary: | build deps librln
|
||||
wakucanary: | build deps librln negentropy
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim wakucanary $(NIM_PARAMS) waku.nims
|
||||
|
||||
networkmonitor: | build deps librln
|
||||
networkmonitor: | build deps librln negentropy
|
||||
echo -e $(BUILD_MSG) "build/$@" && \
|
||||
$(ENV_SCRIPT) nim networkmonitor $(NIM_PARAMS) waku.nims
|
||||
|
||||
|
@ -290,7 +289,7 @@ docker-push:
|
|||
|
||||
STATIC ?= false
|
||||
|
||||
libwaku: | build deps librln
|
||||
libwaku: | build deps librln negentropy
|
||||
rm -f build/libwaku*
|
||||
ifeq ($(STATIC), true)
|
||||
echo -e $(BUILD_MSG) "build/$@.a" && \
|
||||
|
|
|
@ -44,9 +44,7 @@ proc setupAndPublish(rng: ref HmacDrbgContext) {.async.} =
|
|||
let
|
||||
nodeKey = crypto.PrivateKey.random(Secp256k1, rng[]).get()
|
||||
ip = parseIpAddress("0.0.0.0")
|
||||
flags = CapabilitiesBitfield.init(
|
||||
lightpush = false, filter = false, store = false, relay = true
|
||||
)
|
||||
flags = CapabilitiesBitfield.init(relay = true)
|
||||
|
||||
var enrBuilder = EnrBuilder.init(nodeKey)
|
||||
|
||||
|
|
|
@ -42,9 +42,7 @@ proc setupAndSubscribe(rng: ref HmacDrbgContext) {.async.} =
|
|||
let
|
||||
nodeKey = crypto.PrivateKey.random(Secp256k1, rng[])[]
|
||||
ip = parseIpAddress("0.0.0.0")
|
||||
flags = CapabilitiesBitfield.init(
|
||||
lightpush = false, filter = false, store = false, relay = true
|
||||
)
|
||||
flags = CapabilitiesBitfield.init(relay = true)
|
||||
|
||||
var enrBuilder = EnrBuilder.init(nodeKey)
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ suite "Waku Peer Exchange with discv5":
|
|||
let
|
||||
# todo: px flag
|
||||
flags = CapabilitiesBitfield.init(
|
||||
lightpush = false, filter = false, store = false, relay = true, sync = false
|
||||
lightpush = false, filter = false, store = false, relay = true
|
||||
)
|
||||
bindIp = parseIpAddress("0.0.0.0")
|
||||
extIp = parseIpAddress("127.0.0.1")
|
||||
|
|
|
@ -18,7 +18,7 @@ suite "Waku ENR - Capabilities bitfield":
|
|||
test "bitfield to capabilities list":
|
||||
## Given
|
||||
let bitfield = CapabilitiesBitfield.init(
|
||||
relay = true, store = false, lightpush = true, filter = true, sync = false
|
||||
relay = true, store = false, lightpush = true, filter = true
|
||||
)
|
||||
|
||||
## When
|
||||
|
|
|
@ -8,7 +8,7 @@ include ../../waku/node/config
|
|||
|
||||
proc defaultTestWakuFlags(): CapabilitiesBitfield =
|
||||
CapabilitiesBitfield.init(
|
||||
lightpush = false, filter = false, store = false, relay = true, sync = false
|
||||
lightpush = false, filter = false, store = false, relay = true
|
||||
)
|
||||
|
||||
suite "Waku NetConfig":
|
||||
|
|
|
@ -38,7 +38,7 @@ suite "Waku Peer Exchange":
|
|||
let
|
||||
# todo: px flag
|
||||
flags = CapabilitiesBitfield.init(
|
||||
lightpush = false, filter = false, store = false, relay = true, sync = false
|
||||
lightpush = false, filter = false, store = false, relay = true
|
||||
)
|
||||
bindIp = parseIpAddress("0.0.0.0")
|
||||
extIp = parseIpAddress("127.0.0.1")
|
||||
|
|
Binary file not shown.
|
@ -25,7 +25,7 @@ type
|
|||
Sync = 4
|
||||
|
||||
func init*(
|
||||
T: type CapabilitiesBitfield, lightpush, filter, store, relay, sync: bool
|
||||
T: type CapabilitiesBitfield, lightpush, filter, store, relay, sync: bool = false
|
||||
): T =
|
||||
## Creates an waku2 ENR flag bit field according to RFC 31 (https://rfc.vac.dev/spec/31/)
|
||||
var bitfield: uint8
|
||||
|
|
|
@ -10,18 +10,18 @@ proc encode*(req: SyncPayload): ProtoBuffer =
|
|||
var pb = initProtoBuffer()
|
||||
|
||||
if req.rangeStart.isSome() and req.rangeEnd.isSome():
|
||||
pb.write3(1, req.rangeStart.get())
|
||||
pb.write3(2, req.rangeEnd.get())
|
||||
pb.write3(31, req.rangeStart.get())
|
||||
pb.write3(32, req.rangeEnd.get())
|
||||
|
||||
if req.frameSize.isSome():
|
||||
pb.write3(3, req.frameSize.get())
|
||||
pb.write3(33, req.frameSize.get())
|
||||
|
||||
if req.negentropy.len > 0:
|
||||
pb.write3(4, req.negentropy)
|
||||
pb.write3(1, req.negentropy)
|
||||
|
||||
if req.hashes.len > 0:
|
||||
for hash in req.hashes:
|
||||
pb.write3(5, hash)
|
||||
pb.write3(20, hash)
|
||||
|
||||
return pb
|
||||
|
||||
|
@ -30,31 +30,31 @@ proc decode*(T: type SyncPayload, buffer: seq[byte]): ProtobufResult[T] =
|
|||
let pb = initProtoBuffer(buffer)
|
||||
|
||||
var start: uint64
|
||||
if ?pb.getField(1, start):
|
||||
if ?pb.getField(31, start):
|
||||
req.rangeStart = some(start)
|
||||
else:
|
||||
req.rangeStart = none(uint64)
|
||||
|
||||
var `end`: uint64
|
||||
if ?pb.getField(2, `end`):
|
||||
if ?pb.getField(32, `end`):
|
||||
req.rangeEnd = some(`end`)
|
||||
else:
|
||||
req.rangeEnd = none(uint64)
|
||||
|
||||
var frame: uint64
|
||||
if ?pb.getField(3, frame):
|
||||
if ?pb.getField(33, frame):
|
||||
req.frameSize = some(frame)
|
||||
else:
|
||||
req.frameSize = none(uint64)
|
||||
|
||||
var negentropy: seq[byte]
|
||||
if ?pb.getField(4, negentropy):
|
||||
if ?pb.getField(1, negentropy):
|
||||
req.negentropy = negentropy
|
||||
else:
|
||||
req.negentropy = @[]
|
||||
|
||||
var buffer: seq[seq[byte]]
|
||||
if not ?pb.getRepeatedField(5, buffer):
|
||||
if not ?pb.getRepeatedField(20, buffer):
|
||||
req.hashes = @[]
|
||||
else:
|
||||
req.hashes = newSeqOfCap[WakuMessageHash](buffer.len)
|
||||
|
|
|
@ -167,7 +167,7 @@ proc clientReconcile*(
|
|||
|
||||
return ok(res)
|
||||
|
||||
let payload = SyncPayload(negentropy: seq[byte](response), hashes: haves)
|
||||
let payload = SyncPayload(negentropy: seq[byte](response))
|
||||
|
||||
let res = Result[Reconciled[ClientSync], Completed[ClientSync]].ok(
|
||||
Reconciled[ClientSync](
|
||||
|
|
Loading…
Reference in New Issue