Skip to content

Commit

Permalink
fix(rln-relay): uncomment fields in proto decode
Browse files Browse the repository at this point in the history
  • Loading branch information
rymnc committed Jan 23, 2023
1 parent 30c08d6 commit ab64d4b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 0 additions & 2 deletions tests/v2/test_wakunode_rln_relay.nim
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ procSuite "WakuNode - RLN relay":
rlnRelayPubSubTopic = RlnRelayPubsubTopic
contentTopic = ContentTopic("/waku/2/default-content/proto")

# set up three nodes
# node1
# set up three nodes
# node1
await node1.mountRelay(@[rlnRelayPubSubTopic])
Expand Down
12 changes: 6 additions & 6 deletions waku/v2/protocol/waku_message.nim
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,20 @@ proc decode*(T: type WakuMessage, buffer: seq[byte]): ProtoResult[T] =

discard ?pb.getField(1, msg.payload)
discard ?pb.getField(2, msg.contentTopic)
# discard ?pb.getField(3, msg.version)
discard ?pb.getField(3, msg.version)

var timestamp: zint64
# discard ?pb.getField(10, timestamp)
discard ?pb.getField(10, timestamp)
msg.timestamp = Timestamp(timestamp)

# Experimental: this is part of https://rfc.vac.dev/spec/17/ spec
when defined(rln):
var proofBytes: seq[byte]
# if ?pb.getField(21, proofBytes):
# msg.proof = proofBytes
if ?pb.getField(21, proofBytes):
msg.proof = proofBytes

var ephemeral: uint
# if ?pb.getField(31, ephemeral):
# msg.ephemeral = bool(ephemeral)
if ?pb.getField(31, ephemeral):
msg.ephemeral = bool(ephemeral)

ok(msg)
2 changes: 1 addition & 1 deletion waku/v2/protocol/waku_rln_relay/rln_relay.nim
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ proc validateMessage*(rlnPeer: WakuRLNRelay, msg: WakuMessage,
# message's epoch is too old or too ahead
# accept messages whose epoch is within +-MaxEpochGap from the current epoch
warn "invalid message: epoch gap exceeds a threshold", gap = gap,
payload = string.fromBytes(msg.payload)
payload = string.fromBytes(msg.payload), msgEpoch = fromEpoch(proof.epoch)
waku_rln_invalid_messages_total.inc(labelValues=["invalid_epoch"])
return MessageValidationResult.Invalid

Expand Down

0 comments on commit ab64d4b

Please sign in to comment.