-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(rln-relay-v2): rln-keystore-generator updates #2392
Conversation
This PR may contain changes to configuration options of one of the apps. If you are introducing a breaking change (i.e. the set of options in latest release would no longer be applicable) make sure the original option is preserved with a deprecation note for 2 following releases before it is actually removed. Please also make sure the label |
You can find the image built from this PR at
Built from ec10d52 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM even though I don't have a profound knowledge on the topic!
Thanks! 🥳
apps/wakunode2/external_config.nim
Outdated
@@ -79,6 +79,11 @@ type | |||
desc: "Private key for broadcasting transactions", | |||
defaultValue: "", | |||
name: "rln-relay-eth-private-key" }: string | |||
|
|||
rlnRelayUserMessageLimit* {. | |||
desc: "Set a user message limit for the rln membership registration.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick comment: shall we add the units to make it clearer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in 3be31f0
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()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to this PR but the valueOr
and isOkOr
result statements are very interesting
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()) | |
let proofGen = proofGen(rlnInstance = g.rlnInstance, | |
data = data, | |
memKeys = g.idCredentials.get(), | |
memIndex = g.membershipIndex.get(), | |
epoch = epoch).valueOr: | |
return err("proof generation failed: " & $error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in ea8dd11
|
||
let groupKeys = g.groupKeys | ||
|
||
for i in 0..<groupKeys.len(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick again:)
for i in 0..<groupKeys.len(): | |
for i in 0..<groupKeys.len: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in 69bd411
memberSeq.add(Membership(rateCommitment: rateCommitments[i], index: g.latestIndex + MembershipIndex(i) + 1)) | ||
await g.registerCb.get()(memberSeq) | ||
|
||
discard g.slideRootQueue() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for further PRs we'd need to tackle all the discard
statements that we have in rln
code base.
|
||
if g.registerCb.isSome(): | ||
var memberSeq = newSeq[Membership]() | ||
for i in 0..<rateCommitments.len(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpick comment
for i in 0..<rateCommitments.len(): | |
for i in 0..<rateCommitments.len: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in 69bd411
let leavesRes = rateCommitments.toLeaves() | ||
if not leavesRes.isOk(): | ||
raise newException(ValueError, "Failed to convert rate commitments to leaves") | ||
let leaves = cast[seq[seq[byte]]](leavesRes.get()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May it be more explicit?
let leaves = cast[seq[seq[byte]]](leavesRes.get()) | |
let leaves = cast[seq[IDCommitment]](leavesRes.get()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this may cause confusion about converting the rateCommitment into an IDCommitment, when that is not the case. here we have used seq[byte] to discern it from an IDCommitment. I don't see the value in creating a type for it i.e SerializedRateCommitment yet.
|
||
if g.registerCb.isSome(): | ||
var memberSeq = newSeq[Membership]() | ||
for i in 0..<idCommitments.len(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for i in 0..<idCommitments.len(): | |
for i in 0..<idCommitments.len: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in 69bd411
|
||
discard g.slideRootQueue() | ||
|
||
g.latestIndex += MembershipIndex(idCommitments.len()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
g.latestIndex += MembershipIndex(idCommitments.len()) | |
g.latestIndex += MembershipIndex(idCommitments.len) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in 69bd411
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm.
Out of curiosity, rlnRelayUserMessageLimit
over which epoch size is applied? The default one of 1 sec?
Description
Updates the contract listening and registration process, and inserts rateCommitments into the tree instead of idCommitments
A follow up PR will be created to:
Changes
--rln-relay-user-message-limit
to be set while running the keystore generator, which is included in the key creation in the keyfileHow to test
RLN_V2=true make -j16 wakunode2
which yields the below output:
Issue
addresses a part of #2345