mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-05-16 15:29:41 +00:00
chore: debug mesage to find flow
This commit is contained in:
parent
62541d7545
commit
4e69f90847
@ -11,6 +11,7 @@ proc unsafeAppendRLNProof*(
|
|||||||
## this proc derived from appendRLNProof, does not perform nonce check to
|
## this proc derived from appendRLNProof, does not perform nonce check to
|
||||||
## facilitate bad message id generation for testing
|
## facilitate bad message id generation for testing
|
||||||
|
|
||||||
|
debug "calling generateProof from unsafeAppendRLNProof from waku_rln_relay_utils"
|
||||||
let input = msg.toRLNSignal()
|
let input = msg.toRLNSignal()
|
||||||
let epoch = rlnPeer.calcEpoch(senderEpochTime)
|
let epoch = rlnPeer.calcEpoch(senderEpochTime)
|
||||||
|
|
||||||
|
|||||||
@ -70,6 +70,7 @@ proc sendRlnMessageWithInvalidProof*(
|
|||||||
completionFuture: Future[bool],
|
completionFuture: Future[bool],
|
||||||
payload: seq[byte] = "Hello".toBytes(),
|
payload: seq[byte] = "Hello".toBytes(),
|
||||||
): Future[bool] {.async.} =
|
): Future[bool] {.async.} =
|
||||||
|
debug "calling generateProof from sendRlnMessageWithInvalidProof from utils_static"
|
||||||
let
|
let
|
||||||
extraBytes: seq[byte] = @[byte(1), 2, 3]
|
extraBytes: seq[byte] = @[byte(1), 2, 3]
|
||||||
rateLimitProofRes = client.wakuRlnRelay.groupManager.generateProof(
|
rateLimitProofRes = client.wakuRlnRelay.groupManager.generateProof(
|
||||||
|
|||||||
@ -265,6 +265,7 @@ proc installRelayApiHandlers*(
|
|||||||
error "publish error", err = msg
|
error "publish error", err = msg
|
||||||
return RestApiResponse.badRequest("Failed to publish. " & 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 RLN is mounted, append the proof to the message
|
||||||
if not node.wakuRlnRelay.isNil():
|
if not node.wakuRlnRelay.isNil():
|
||||||
node.wakuRlnRelay.appendRLNProof(message, float64(getTime().toUnix())).isOkOr:
|
node.wakuRlnRelay.appendRLNProof(message, float64(getTime().toUnix())).isOkOr:
|
||||||
@ -272,6 +273,7 @@ proc installRelayApiHandlers*(
|
|||||||
"Failed to publish: error appending RLN proof to message: " & $error
|
"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:
|
(await node.wakuRelay.validateMessage(pubsubTopic, message)).isOkOr:
|
||||||
return RestApiResponse.badRequest("Failed to publish: " & error)
|
return RestApiResponse.badRequest("Failed to publish: " & error)
|
||||||
|
|
||||||
|
|||||||
@ -14,6 +14,7 @@ proc checkAndGenerateRLNProof*(
|
|||||||
rlnPeer: Option[WakuRLNRelay], message: WakuMessage
|
rlnPeer: Option[WakuRLNRelay], message: WakuMessage
|
||||||
): Result[WakuMessage, string] =
|
): Result[WakuMessage, string] =
|
||||||
# check if the message already has RLN proof
|
# check if the message already has RLN proof
|
||||||
|
debug "calling appendRLNProof from checkAndGenerateRLNProof from waku_lightpush_legacy"
|
||||||
if message.proof.len > 0:
|
if message.proof.len > 0:
|
||||||
return ok(message)
|
return ok(message)
|
||||||
|
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import
|
|||||||
../protocol_metrics,
|
../protocol_metrics,
|
||||||
../constants,
|
../constants,
|
||||||
../rln
|
../rln
|
||||||
import options, chronos, results, std/[deques, sequtils]
|
import options, chronos, results, std/[deques, sequtils], chronicles
|
||||||
|
|
||||||
export options, chronos, results, protocol_types, protocol_metrics, deques
|
export options, chronos, results, protocol_types, protocol_metrics, deques
|
||||||
|
|
||||||
@ -145,6 +145,17 @@ method validateRoot*(
|
|||||||
g: GroupManager, root: MerkleNode
|
g: GroupManager, root: MerkleNode
|
||||||
): bool {.base, gcsafe, raises: [].} =
|
): bool {.base, gcsafe, raises: [].} =
|
||||||
## validates the root against the valid roots queue
|
## validates the root against the valid roots queue
|
||||||
|
# Print all validRoots in one line with square brackets
|
||||||
|
var rootsStr = "["
|
||||||
|
var first = true
|
||||||
|
for r in g.validRoots.items():
|
||||||
|
if not first:
|
||||||
|
rootsStr.add(", ")
|
||||||
|
rootsStr.add($r)
|
||||||
|
first = false
|
||||||
|
rootsStr.add("]")
|
||||||
|
debug "Valid Merkle roots in validateRoot", roots = rootsStr, root_to_validate = root
|
||||||
|
|
||||||
# Check if the root is in the valid roots queue
|
# Check if the root is in the valid roots queue
|
||||||
if g.indexOfRoot(root) >= 0:
|
if g.indexOfRoot(root) >= 0:
|
||||||
return true
|
return true
|
||||||
@ -189,6 +200,9 @@ method generateProof*(
|
|||||||
return err("membership index is not set")
|
return err("membership index is not set")
|
||||||
if g.userMessageLimit.isNone():
|
if g.userMessageLimit.isNone():
|
||||||
return err("user message limit is not set")
|
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:
|
waku_rln_proof_generation_duration_seconds.nanosecondTime:
|
||||||
let proof = proofGen(
|
let proof = proofGen(
|
||||||
rlnInstance = g.rlnInstance,
|
rlnInstance = g.rlnInstance,
|
||||||
|
|||||||
@ -193,6 +193,8 @@ proc validateMessage*(
|
|||||||
## `timeOption` indicates Unix epoch time (fractional part holds sub-seconds)
|
## `timeOption` indicates Unix epoch time (fractional part holds sub-seconds)
|
||||||
## if `timeOption` is supplied, then the current epoch is calculated based on that
|
## if `timeOption` is supplied, then the current epoch is calculated based on that
|
||||||
|
|
||||||
|
debug "calling validateMessage from rln_relay", msg = msg
|
||||||
|
|
||||||
let decodeRes = RateLimitProof.init(msg.proof)
|
let decodeRes = RateLimitProof.init(msg.proof)
|
||||||
if decodeRes.isErr():
|
if decodeRes.isErr():
|
||||||
return MessageValidationResult.Invalid
|
return MessageValidationResult.Invalid
|
||||||
@ -316,6 +318,8 @@ proc appendRLNProof*(
|
|||||||
let input = msg.toRLNSignal()
|
let input = msg.toRLNSignal()
|
||||||
let epoch = rlnPeer.calcEpoch(senderEpochTime)
|
let epoch = rlnPeer.calcEpoch(senderEpochTime)
|
||||||
|
|
||||||
|
debug "calling generateProof from appendRLNProof from rln_relay", input = input
|
||||||
|
|
||||||
let nonce = rlnPeer.nonceManager.getNonce().valueOr:
|
let nonce = rlnPeer.nonceManager.getNonce().valueOr:
|
||||||
return err("could not get new message id to generate an rln proof: " & $error)
|
return err("could not get new message id to generate an rln proof: " & $error)
|
||||||
let proof = rlnPeer.groupManager.generateProof(input, epoch, nonce).valueOr:
|
let proof = rlnPeer.groupManager.generateProof(input, epoch, nonce).valueOr:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user