Skip to content
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): nonce/messageId manager #2413

Merged
merged 3 commits into from
Feb 13, 2024
Merged

Conversation

rymnc
Copy link
Contributor

@rymnc rymnc commented Feb 9, 2024

Description

This PR introduces a new submodule within waku_rln_relay, called the NonceManager which provides functionality to fetch the next given nonce/messageId on a per epoch basis which is required to generate rln-v2 proofs.

It also fixes the bad function signature of appendRLNProof which previously returned a boolean upon execution. It now returns a result.

Changes

  • NonceManager
  • appendRLNProof sig change
  • NonceManager tests

How to test

  1. RLN_V2=true make -j16 test is broken at the moment since the onchain/static group manager tests have not been updated yet. However, the NonceManager is independent of those changes, and can be run, and has not been guarded by the rln_v2 feature flag upon running make -j16 test

Issue

closes #2415

@rymnc rymnc added the E:RLN on mainnet see https://github.com/waku-org/pm/issues/98 for details label Feb 9, 2024
@rymnc rymnc self-assigned this Feb 9, 2024
Copy link

github-actions bot commented Feb 9, 2024

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 release-notes is added to make sure any changes to the user interface are properly announced in changelog and release notes.

Copy link

github-actions bot commented Feb 9, 2024

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:2413

Built from 7c704b5

@rymnc rymnc mentioned this pull request Feb 9, 2024
17 tasks
@rymnc rymnc force-pushed the nonce-manager-rln-v2 branch from 2c4eaf0 to c3e7c58 Compare February 9, 2024 18:33
@rymnc rymnc assigned alrevuelta and unassigned alrevuelta Feb 9, 2024
@rymnc rymnc requested a review from alrevuelta February 9, 2024 21:30
Copy link
Contributor

@alrevuelta alrevuelta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, minor comment.


proc get*(n: NonceManager): NonceManagerResult[Nonce] =
let now = getTime().toUnixFloat()
var retNonce = n.nextNonce
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the if/else you set the value of retNonce in both cases. So this assigment will be overridden no matter what? Meaning its not needed?

or well, you can avoid the else, something like?

var retNonce = n.nextNonce
if now - n.lastNonceTime >= n.epoch:
  retNonce = 0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in 699a5bc

Copy link
Contributor

@SionoiS SionoiS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks!

@rymnc rymnc merged commit 50308ed into master Feb 13, 2024
10 checks passed
@rymnc rymnc deleted the nonce-manager-rln-v2 branch February 13, 2024 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E:RLN on mainnet see https://github.com/waku-org/pm/issues/98 for details
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rln-v2: Node must use a monotonically increasing nonce for each proof generation
3 participants