mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-05-16 07:19:29 +00:00
chore: add merkleroot macro for testing purpose inside generateProof
This commit is contained in:
parent
4fd9609e98
commit
28d5445f2b
@ -98,7 +98,7 @@ proc fetchMerkleProofElements*(
|
|||||||
let merkleProof = await merkleProofInvocation.call()
|
let merkleProof = await merkleProofInvocation.call()
|
||||||
return ok(merkleProof)
|
return ok(merkleProof)
|
||||||
except CatchableError:
|
except CatchableError:
|
||||||
error "Failed to fetch merkle proof", errMsg = getCurrentExceptionMsg()
|
error "Failed to fetch merkle proof - 1", errMsg = getCurrentExceptionMsg()
|
||||||
|
|
||||||
proc fetchMerkleRoot*(
|
proc fetchMerkleRoot*(
|
||||||
g: OnchainGroupManager
|
g: OnchainGroupManager
|
||||||
@ -313,15 +313,23 @@ method generateProof*(
|
|||||||
|
|
||||||
let externalNullifierRes = poseidon(@[@(epoch), @(rlnIdentifier)])
|
let externalNullifierRes = poseidon(@[@(epoch), @(rlnIdentifier)])
|
||||||
|
|
||||||
|
try:
|
||||||
|
let rootRes = waitFor g.fetchMerkleRoot()
|
||||||
|
if rootRes.isErr():
|
||||||
|
return err("Failed to fetch Merkle root")
|
||||||
|
debug "Merkle root fetched", root = rootRes.get().toHex
|
||||||
|
except CatchableError:
|
||||||
|
error "Failed to fetch Merkle root", error = getCurrentExceptionMsg()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
let proofResult = waitFor g.fetchMerkleProofElements()
|
let proofResult = waitFor g.fetchMerkleProofElements()
|
||||||
if proofResult.isErr():
|
if proofResult.isErr():
|
||||||
return err("Failed to fetch Merkle proof: " & $proofResult.error)
|
return err("Failed to fetch Merkle proof - 2: " & $proofResult.error)
|
||||||
g.merkleProofCache = proofResult.get()
|
g.merkleProofCache = proofResult.get()
|
||||||
debug "Merkle proof fetched",
|
debug "Merkle proof fetched",
|
||||||
membershipIndex = g.membershipIndex.get(), elementCount = g.merkleProofCache.len
|
membershipIndex = g.membershipIndex.get(), elementCount = g.merkleProofCache.len
|
||||||
except CatchableError:
|
except CatchableError:
|
||||||
error "Failed to fetch merkle proof", error = getCurrentExceptionMsg()
|
error "Failed to fetch merkle proof - 3", error = getCurrentExceptionMsg()
|
||||||
|
|
||||||
let witness = Witness(
|
let witness = Witness(
|
||||||
identity_secret: g.idCredentials.get().idSecretHash.toArray32(),
|
identity_secret: g.idCredentials.get().idSecretHash.toArray32(),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user