chore: fix lint, add todos

This commit is contained in:
Sergei Tikhomirov 2025-04-04 14:22:28 +02:00
parent c4cb4121ed
commit 49c8f549b3
4 changed files with 9 additions and 4 deletions

View File

@ -89,6 +89,10 @@ proc publish*(
peerId = shortLog(peer.peerId),
msg_hash = computeMessageHash(pubsubTopic.get(""), message).to0xHex
# TODO: i13n POC: add eligibilityProof to the request
# (if expected by the server - how does the client know?..)
# The tx must have already been sent at this point?
let pushRequest = LightpushRequest(
requestId: generateRequestId(wl.rng), pubSubTopic: pubSubTopic, message: message
)

View File

@ -73,6 +73,9 @@ proc handleRequest*(
statusDesc: some(msg),
)
# TODO: i13n POC: check eligibility here (if eligibilityManager.isSome)
# if eligibility check fails, return a response with LightpushStatusCode.PAYMENT_REQUIRED
waku_lightpush_v3_messages.inc(labelValues = ["PushRequest"])
notice "handling lightpush request",

View File

@ -2,7 +2,7 @@
import std/options
import ../waku_core
import waku/incentivization/rpc
import ../incentivization/rpc
type
LightpushRequest* = object

View File

@ -2,7 +2,7 @@
import std/options
import ../common/protobuf, ../waku_core, ./rpc
import waku/incentivization/[rpc, rpc_codec]
import ../incentivization/[rpc, rpc_codec]
const DefaultMaxRpcSize* = -1
@ -13,7 +13,6 @@ proc encode*(rpc: LightpushRequest): ProtoBuffer =
pb.write3(20, rpc.pubSubTopic)
pb.write3(21, rpc.message.encode())
# Only encode eligibilityProof if it exists
if rpc.eligibilityProof.isSome():
pb.write3(22, rpc.eligibilityProof.get().encode())
@ -42,7 +41,6 @@ proc decode*(T: type LightpushRequest, buffer: seq[byte]): ProtobufResult[T] =
else:
rpc.message = ?WakuMessage.decode(messageBuf)
# Decode eligibilityProof only if the field is present
var eligibilityProofBytes: seq[byte]
if not ?pb.getField(22, eligibilityProofBytes):
rpc.eligibilityProof = none(EligibilityProof)