mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-07 08:23:08 +00:00
feat: update
This commit is contained in:
parent
83e4783ccc
commit
23946ff7a0
@ -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)
|
||||
Loading…
x
Reference in New Issue
Block a user