Skip to content

Commit

Permalink
chore(rln-relay): updated metrics for testnet 3 (#1744)
Browse files Browse the repository at this point in the history
* fix(rln-relay): trace log

* chore(rln-relay): updated metrics for testnet 3

fix(rln-relay): group manager metric import
  • Loading branch information
rymnc committed May 19, 2023
1 parent 46e231d commit 6257874
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
13 changes: 8 additions & 5 deletions waku/v2/waku_rln_relay/group_manager/group_manager_base.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import
../protocol_types,
../protocol_metrics,
../constants,
../rln
import
Expand All @@ -13,6 +14,7 @@ export
chronos,
results,
protocol_types,
protocol_metrics,
deques

# This module contains the GroupManager interface
Expand Down Expand Up @@ -148,11 +150,12 @@ method generateProof*(g: GroupManager,
return err("identity credentials are not set")
if g.membershipIndex.isNone():
return err("membership index is not set")
let proofGenRes = proofGen(rlnInstance = g.rlnInstance,
data = data,
memKeys = g.idCredentials.get(),
memIndex = g.membershipIndex.get(),
epoch = epoch)
waku_rln_proof_generation_duration_seconds.nanosecondTime:
let proofGenRes = proofGen(rlnInstance = g.rlnInstance,
data = data,
memKeys = g.idCredentials.get(),
memIndex = g.membershipIndex.get(),
epoch = epoch)
if proofGenRes.isErr():
return err("proof generation failed: " & $proofGenRes.error())
return ok(proofGenRes.value())
17 changes: 10 additions & 7 deletions waku/v2/waku_rln_relay/group_manager/on_chain/group_manager.nim
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ method atomicBatch*(g: OnchainGroupManager,
initializedGuard(g)

let startIndex = g.latestIndex
let operationSuccess = g.rlnInstance.atomicWrite(some(startIndex), idCommitments, toRemoveIndices)
waku_rln_membership_insertion_duration_seconds.nanosecondTime:
let operationSuccess = g.rlnInstance.atomicWrite(some(startIndex), idCommitments, toRemoveIndices)
if not operationSuccess:
raise newException(ValueError, "atomic batch operation failed")

Expand Down Expand Up @@ -371,7 +372,8 @@ method startGroupSync*(g: OnchainGroupManager): Future[void] {.async.} =
g.idCredentials = some(idCredential)

debug "registering commitment on contract"
await g.register(idCredential)
waku_rln_registration_duration_seconds.nanosecondTime:
await g.register(idCredential)
if g.registrationHandler.isSome():
# We need to callback with the tx hash
let handler = g.registrationHandler.get()
Expand Down Expand Up @@ -427,11 +429,12 @@ method init*(g: OnchainGroupManager): Future[void] {.async.} =
g.membershipFee = some(membershipFee)

if g.keystorePath.isSome() and g.keystorePassword.isSome():
let parsedCredsRes = getMembershipCredentials(path = g.keystorePath.get(),
password = g.keystorePassword.get(),
filterMembershipContracts = @[MembershipContract(chainId: $chainId,
address: g.ethContractAddress)],
appInfo = RLNAppInfo)
waku_rln_membership_credentials_import_duration_seconds.nanosecondTime:
let parsedCredsRes = getMembershipCredentials(path = g.keystorePath.get(),
password = g.keystorePassword.get(),
filterMembershipContracts = @[MembershipContract(chainId: $chainId,
address: g.ethContractAddress)],
appInfo = RLNAppInfo)
if parsedCredsRes.isErr():
raise newException(ValueError, "could not parse the keystore: " & $parsedCredsRes.error())
let parsedCreds = parsedCredsRes.get()
Expand Down

0 comments on commit 6257874

Please sign in to comment.