mirror of https://github.com/waku-org/nwaku.git
fix(rln-relay): feature guard (#1373)
* fix(rln-relay): feature guard
* Revert "fix(rln-relay): feature guard"
This reverts commit 9344f41a34
.
* fix(rln-relay): surgically fix imports
* fix(rln-relay): indents
* fix(rln-relay): more usages of rln types
This commit is contained in:
parent
97eaa6919b
commit
2336522d7f
|
@ -31,7 +31,6 @@ import
|
|||
../protocol/waku_filter/client as filter_client,
|
||||
../protocol/waku_lightpush,
|
||||
../protocol/waku_lightpush/client as lightpush_client,
|
||||
../protocol/waku_rln_relay/waku_rln_relay_types,
|
||||
../protocol/waku_peer_exchange,
|
||||
../utils/peers,
|
||||
../utils/wakuenr,
|
||||
|
@ -43,6 +42,10 @@ import
|
|||
./discv5/waku_discv5,
|
||||
./wakuswitch
|
||||
|
||||
when defined(rln):
|
||||
import
|
||||
../protocol/waku_rln_relay/waku_rln_relay_types
|
||||
|
||||
declarePublicGauge waku_version, "Waku version info (in git describe format)", ["version"]
|
||||
declarePublicCounter waku_node_messages, "number of messages received", ["type"]
|
||||
declarePublicGauge waku_node_errors, "number of wakunode errors", ["type"]
|
||||
|
@ -86,6 +89,7 @@ type
|
|||
wakuFilter*: WakuFilter
|
||||
wakuFilterClient*: WakuFilterClient
|
||||
wakuSwap*: WakuSwap
|
||||
when defined(rln):
|
||||
wakuRlnRelay*: WakuRLNRelay
|
||||
wakuLightPush*: WakuLightPush
|
||||
wakuLightpushClient*: WakuLightPushClient
|
||||
|
|
|
@ -16,7 +16,10 @@ import
|
|||
libp2p/varint
|
||||
import
|
||||
../utils/protobuf,
|
||||
../utils/time,
|
||||
../utils/time
|
||||
|
||||
when defined(rln):
|
||||
import
|
||||
./waku_rln_relay/waku_rln_relay_types
|
||||
|
||||
|
||||
|
@ -40,6 +43,7 @@ type WakuMessage* = object
|
|||
# the proof field indicates that the message is not a spam
|
||||
# this field will be used in the rln-relay protocol
|
||||
# XXX Experimental, this is part of https://rfc.vac.dev/spec/17/ spec and not yet part of WakuMessage spec
|
||||
when defined(rln):
|
||||
proof*: RateLimitProof
|
||||
# The ephemeral field indicates if the message should
|
||||
# be stored. bools and uints are
|
||||
|
@ -56,6 +60,7 @@ proc encode*(message: WakuMessage): ProtoBuffer =
|
|||
buf.write3(2, message.contentTopic)
|
||||
buf.write3(3, message.version)
|
||||
buf.write3(10, zint64(message.timestamp))
|
||||
when defined(rln):
|
||||
buf.write3(21, message.proof.encode())
|
||||
buf.write3(31, uint64(message.ephemeral))
|
||||
buf.finish3()
|
||||
|
@ -75,6 +80,7 @@ proc decode*(T: type WakuMessage, buffer: seq[byte]): ProtoResult[T] =
|
|||
msg.timestamp = Timestamp(timestamp)
|
||||
|
||||
# XXX Experimental, this is part of https://rfc.vac.dev/spec/17/ spec
|
||||
when defined(rln):
|
||||
var proofBytes: seq[byte]
|
||||
discard ?pb.getField(21, proofBytes)
|
||||
msg.proof = ?RateLimitProof.init(proofBytes)
|
||||
|
|
Loading…
Reference in New Issue