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

* fix(rln-relay): trace log

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

fix(rln-relay): group manager metric import
This commit is contained in:
Aaryamann Challani 2023-05-19 16:24:35 +05:30 committed by GitHub
parent 46e231d03f
commit 6257874633
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 12 deletions

View File

@ -1,5 +1,6 @@
import import
../protocol_types, ../protocol_types,
../protocol_metrics,
../constants, ../constants,
../rln ../rln
import import
@ -13,6 +14,7 @@ export
chronos, chronos,
results, results,
protocol_types, protocol_types,
protocol_metrics,
deques deques
# This module contains the GroupManager interface # This module contains the GroupManager interface
@ -148,11 +150,12 @@ method generateProof*(g: GroupManager,
return err("identity credentials are not set") return err("identity credentials are not set")
if g.membershipIndex.isNone(): if g.membershipIndex.isNone():
return err("membership index is not set") return err("membership index is not set")
let proofGenRes = proofGen(rlnInstance = g.rlnInstance, waku_rln_proof_generation_duration_seconds.nanosecondTime:
data = data, let proofGenRes = proofGen(rlnInstance = g.rlnInstance,
memKeys = g.idCredentials.get(), data = data,
memIndex = g.membershipIndex.get(), memKeys = g.idCredentials.get(),
epoch = epoch) memIndex = g.membershipIndex.get(),
epoch = epoch)
if proofGenRes.isErr(): if proofGenRes.isErr():
return err("proof generation failed: " & $proofGenRes.error()) return err("proof generation failed: " & $proofGenRes.error())
return ok(proofGenRes.value()) return ok(proofGenRes.value())

View File

@ -75,7 +75,8 @@ method atomicBatch*(g: OnchainGroupManager,
initializedGuard(g) initializedGuard(g)
let startIndex = g.latestIndex 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: if not operationSuccess:
raise newException(ValueError, "atomic batch operation failed") raise newException(ValueError, "atomic batch operation failed")
@ -371,7 +372,8 @@ method startGroupSync*(g: OnchainGroupManager): Future[void] {.async.} =
g.idCredentials = some(idCredential) g.idCredentials = some(idCredential)
debug "registering commitment on contract" debug "registering commitment on contract"
await g.register(idCredential) waku_rln_registration_duration_seconds.nanosecondTime:
await g.register(idCredential)
if g.registrationHandler.isSome(): if g.registrationHandler.isSome():
# We need to callback with the tx hash # We need to callback with the tx hash
let handler = g.registrationHandler.get() let handler = g.registrationHandler.get()
@ -427,11 +429,12 @@ method init*(g: OnchainGroupManager): Future[void] {.async.} =
g.membershipFee = some(membershipFee) g.membershipFee = some(membershipFee)
if g.keystorePath.isSome() and g.keystorePassword.isSome(): if g.keystorePath.isSome() and g.keystorePassword.isSome():
let parsedCredsRes = getMembershipCredentials(path = g.keystorePath.get(), waku_rln_membership_credentials_import_duration_seconds.nanosecondTime:
password = g.keystorePassword.get(), let parsedCredsRes = getMembershipCredentials(path = g.keystorePath.get(),
filterMembershipContracts = @[MembershipContract(chainId: $chainId, password = g.keystorePassword.get(),
address: g.ethContractAddress)], filterMembershipContracts = @[MembershipContract(chainId: $chainId,
appInfo = RLNAppInfo) address: g.ethContractAddress)],
appInfo = RLNAppInfo)
if parsedCredsRes.isErr(): if parsedCredsRes.isErr():
raise newException(ValueError, "could not parse the keystore: " & $parsedCredsRes.error()) raise newException(ValueError, "could not parse the keystore: " & $parsedCredsRes.error())
let parsedCreds = parsedCredsRes.get() let parsedCreds = parsedCredsRes.get()