feat: update

This commit is contained in:
darshankabariya 2025-03-12 13:32:51 +05:30
parent 83e4783ccc
commit 23946ff7a0

View File

@ -12,7 +12,7 @@ import
logScope:
topics = "waku rln_relay onchain_sync_group_manager"
type OnChainSyncGroupManager* = ref object of onchain.OnchainGroupManager
type OnChainSyncGroupManager* = ref object of OnchainGroupManager
# Cache for merkle proofs by index
merkleProofsByIndex*: Table[Uint256, seq[Uint256]]
@ -105,24 +105,4 @@ method generateProof*(
shareY: shareY,
nullifier: nullifier,
)
return ok(output)
method register*(
g: OnChainSyncGroupManager,
identityCredential: IdentityCredential,
userMessageLimit: UserMessageLimit,
): Future[void] {.async: (raises: [Exception]).} =
# Call parent's register method first
await procCall onchain.OnchainGroupManager(g).register(
identityCredential, userMessageLimit
)
# After registration, fetch and cache the merkle proof
let membershipIndex = g.membershipIndex.get()
try:
let merkleProofInvocation =
g.wakuRlnContract.get().merkleProofElements(stuint(membershipIndex, 256))
let merkleProof = await merkleProofInvocation.call()
g.merkleProofsByIndex[stuint(membershipIndex, 256)] = merkleProof
except CatchableError:
error "Failed to fetch initial merkle proof: " & getCurrentExceptionMsg()
return ok(output)