Skip to content

feat: refine work with membership info and other meta information #2341

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

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

danisharora099
Copy link
Collaborator

@danisharora099 danisharora099 commented Apr 7, 2025

Problem / Description

There are a few problems with the current adapter:

  • idCommitment is a stringified hex
  • getMembershipInfo doesn't return all available membership info fields
  • validateRateLimit validates the upper and lower bounds defined in the adapter, instead of the contract

Solution

  • use bigint for idCommitment instead of string
  • fix: getMembershipInfo to fetch, and return, ALL available data
  • fix: validate rate limits from contract

Notes


Checklist

  • Code changes are covered by unit tests.
  • Code changes are covered by e2e tests, if applicable.
  • Dogfooding has been performed, if feasible.
  • A test version has been published, if required.
  • All CI checks pass successfully.

Copy link

github-actions bot commented Apr 7, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
Waku node 61.07 KB (-1.48% 🔽) 1.3 s (-1.48% 🔽) 8.4 s (+11.18% 🔺) 9.6 s
Waku Simple Light Node 114.93 KB (+0.09% 🔺) 2.3 s (+0.09% 🔺) 10.9 s (+8.13% 🔺) 13.2 s
ECIES encryption 23.13 KB (+0.54% 🔺) 463 ms (+0.54% 🔺) 4.4 s (+3.37% 🔺) 4.8 s
Symmetric encryption 22.53 KB (+0.41% 🔺) 451 ms (+0.41% 🔺) 4.5 s (+31.57% 🔺) 5 s
DNS discovery 50.75 KB (-0.15% 🔽) 1.1 s (-0.15% 🔽) 8.1 s (+7.08% 🔺) 9.1 s
Peer Exchange discovery 51.13 KB (-0.49% 🔽) 1.1 s (-0.49% 🔽) 5.4 s (+8.94% 🔺) 6.5 s
Local Peer Cache Discovery 44.49 KB (-0.47% 🔽) 890 ms (-0.47% 🔽) 7.5 s (+47.69% 🔺) 8.4 s
Privacy preserving protocols 51.99 KB (-1.8% 🔽) 1.1 s (-1.8% 🔽) 7.2 s (+10.62% 🔺) 8.3 s
Waku Filter 54.02 KB (-1.65% 🔽) 1.1 s (-1.65% 🔽) 6.4 s (-16.81% 🔽) 7.5 s
Waku LightPush 51.41 KB (-1.68% 🔽) 1.1 s (-1.68% 🔽) 6.5 s (-13.23% 🔽) 7.5 s
History retrieval protocols 51.72 KB (-1.71% 🔽) 1.1 s (-1.71% 🔽) 6.4 s (-12.09% 🔽) 7.4 s
Deterministic Message Hashing 7.28 KB (-0.68% 🔽) 146 ms (-0.68% 🔽) 878 ms (-35.68% 🔽) 1.1 s

@danisharora099 danisharora099 force-pushed the feat/rln-improvements branch 5 times, most recently from 197ba46 to d0da8f8 Compare April 14, 2025 08:26
@danisharora099 danisharora099 force-pushed the feat/rln-improvements branch from a824fff to 08af18e Compare May 13, 2025 09:03
@danisharora099 danisharora099 marked this pull request as ready for review May 13, 2025 10:07
@danisharora099 danisharora099 requested a review from a team as a code owner May 13, 2025 10:07
@danisharora099 danisharora099 marked this pull request as draft May 13, 2025 10:08
@danisharora099 danisharora099 marked this pull request as ready for review May 13, 2025 14:45
@weboko
Copy link
Collaborator

weboko commented May 14, 2025

@danisharora099 can you create an issue capturing this problem(s)?

and can you, please, make PR name more informative?

}

public async withdraw(token: string, holder: string): Promise<void> {
public async withdraw(token: string, from: string): Promise<void> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

if from wallet address? if so, I would name it like this

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Like? :D

Copy link
Collaborator

Choose a reason for hiding this comment

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

like wallet ;)

) {
private async validateRateLimit(rateLimit: number): Promise<void> {
const [minRate, maxRate] = await Promise.all([
this.contract.minMembershipRateLimit(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is something that doesn't change during lifecycle of the contract once it is deployed, I believe

if I am not wrong, then you should fetch this value when contract instance gets instantiated

for that I would recommend using a static method similarly how it is done here
https://github.com/waku-org/js-rln/blob/f6d5deb8cb51602b2b544de5de5b88de96e11aef/src/contract/rln_contract.ts#L56

after that this method becomes sync again

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done here: 10aadbe

}

// Initialize members and subscriptions
this.fetchMembers()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would recommend to improve it even further and:

@danisharora099
Copy link
Collaborator Author

@weboko can you please highlight which comments are blocking comments, and which are nits that aren't as important?

@danisharora099 danisharora099 requested a review from weboko May 19, 2025 10:49
@danisharora099 danisharora099 force-pushed the feat/rln-improvements branch from a7f52e4 to 6d86b6f Compare May 19, 2025 12:14
@weboko weboko changed the title chore(rln): improvements feat: refine work with membership info and other meta information May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: refine work with membership info and other meta information
2 participants