mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-07 00:13:06 +00:00
chore: refine - 4
This commit is contained in:
parent
6cf0682366
commit
629364ff93
@ -11,7 +11,6 @@ proc unsafeAppendRLNProof*(
|
||||
## this proc derived from appendRLNProof, does not perform nonce check to
|
||||
## facilitate bad message id generation for testing
|
||||
|
||||
debug "calling generateProof from unsafeAppendRLNProof from waku_rln_relay_utils"
|
||||
let input = msg.toRLNSignal()
|
||||
let epoch = rlnPeer.calcEpoch(senderEpochTime)
|
||||
|
||||
|
||||
@ -70,7 +70,6 @@ proc sendRlnMessageWithInvalidProof*(
|
||||
completionFuture: Future[bool],
|
||||
payload: seq[byte] = "Hello".toBytes(),
|
||||
): Future[bool] {.async.} =
|
||||
debug "calling generateProof from sendRlnMessageWithInvalidProof from utils_static"
|
||||
let
|
||||
extraBytes: seq[byte] = @[byte(1), 2, 3]
|
||||
rateLimitProofRes = client.wakuRlnRelay.groupManager.generateProof(
|
||||
|
||||
@ -265,7 +265,6 @@ proc installRelayApiHandlers*(
|
||||
error "publish error", err = msg
|
||||
return RestApiResponse.badRequest("Failed to publish. " & msg)
|
||||
|
||||
debug "calling appendRLNProof from post_waku_v2_relay_v1_auto_messages_no_topic"
|
||||
# if RLN is mounted, append the proof to the message
|
||||
if not node.wakuRlnRelay.isNil():
|
||||
node.wakuRlnRelay.appendRLNProof(message, float64(getTime().toUnix())).isOkOr:
|
||||
@ -273,7 +272,6 @@ proc installRelayApiHandlers*(
|
||||
"Failed to publish: error appending RLN proof to message: " & $error
|
||||
)
|
||||
|
||||
debug "calling validateMessage from post_waku_v2_relay_v1_auto_messages_no_topic"
|
||||
(await node.wakuRelay.validateMessage(pubsubTopic, message)).isOkOr:
|
||||
return RestApiResponse.badRequest("Failed to publish: " & error)
|
||||
|
||||
|
||||
@ -14,7 +14,6 @@ proc checkAndGenerateRLNProof*(
|
||||
rlnPeer: Option[WakuRLNRelay], message: WakuMessage
|
||||
): Result[WakuMessage, string] =
|
||||
# check if the message already has RLN proof
|
||||
debug "calling appendRLNProof from checkAndGenerateRLNProof from waku_lightpush_legacy"
|
||||
if message.proof.len > 0:
|
||||
return ok(message)
|
||||
|
||||
|
||||
@ -189,8 +189,6 @@ method generateProof*(
|
||||
if g.userMessageLimit.isNone():
|
||||
return err("user message limit is not set")
|
||||
|
||||
debug "calling proofGen from generateProof from group_manager_base", data = data
|
||||
|
||||
waku_rln_proof_generation_duration_seconds.nanosecondTime:
|
||||
let proof = proofGen(
|
||||
rlnInstance = g.rlnInstance,
|
||||
|
||||
@ -340,11 +340,6 @@ method generateProof*(
|
||||
if g.userMessageLimit.isNone():
|
||||
return err("user message limit is not set")
|
||||
|
||||
debug "calling generateProof from group_manager onchain",
|
||||
data = data,
|
||||
membershipIndex = g.membershipIndex.get(),
|
||||
userMessageLimit = g.userMessageLimit.get()
|
||||
|
||||
try:
|
||||
discard waitFor g.updateRoots()
|
||||
except CatchableError:
|
||||
@ -474,6 +469,7 @@ method verifyProof*(
|
||||
addr proofBuffer, # (proof + signal)
|
||||
addr rootsBuffer, # valid Merkle roots
|
||||
addr validProof # will be set by the FFI call
|
||||
,
|
||||
)
|
||||
|
||||
if not ffiOk:
|
||||
|
||||
@ -193,8 +193,6 @@ proc validateMessage*(
|
||||
## `timeOption` indicates Unix epoch time (fractional part holds sub-seconds)
|
||||
## if `timeOption` is supplied, then the current epoch is calculated based on that
|
||||
|
||||
debug "calling validateMessage from rln_relay", msg_len = msg.payload.len
|
||||
|
||||
let decodeRes = RateLimitProof.init(msg.proof)
|
||||
if decodeRes.isErr():
|
||||
return MessageValidationResult.Invalid
|
||||
@ -246,6 +244,7 @@ proc validateMessage*(
|
||||
waku_rln_errors_total.inc(labelValues = ["proof_verification"])
|
||||
warn "invalid message: proof verification failed", payloadLen = msg.payload.len
|
||||
return MessageValidationResult.Invalid
|
||||
|
||||
if not proofVerificationRes.value():
|
||||
# invalid proof
|
||||
warn "invalid message: invalid proof", payloadLen = msg.payload.len
|
||||
@ -314,8 +313,6 @@ proc appendRLNProof*(
|
||||
let input = msg.toRLNSignal()
|
||||
let epoch = rlnPeer.calcEpoch(senderEpochTime)
|
||||
|
||||
debug "calling generateProof from appendRLNProof from rln_relay", input = input
|
||||
|
||||
let nonce = rlnPeer.nonceManager.getNonce().valueOr:
|
||||
return err("could not get new message id to generate an rln proof: " & $error)
|
||||
let proof = rlnPeer.groupManager.generateProof(input, epoch, nonce).valueOr:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user