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

refactor: do not keep track of membership registration order #14

Merged
merged 5 commits into from
Oct 8, 2024

Conversation

richard-ramos
Copy link
Member

Description

Removes the ordering for the memberships according to discussion in waku-org/specs#34 (comment)

To expire a membership the client must keep track of the membership expiration dates, which can be done by using getCommitments(uint32 startIndex, uint32 endIndex) to retrieve the list of commitments, and expirationDate(uint256 idCommitment) to retrieve the expiration date of the commitments.

@alrevuelta
Copy link

Interesting and simple approach. Perhaps as part of the solution we should include a "reward" for the person calling eraseMemberships? Otherwise we risk that memberships are never expired?

@richard-ramos
Copy link
Member Author

Could be an interesting incentive to add, but where would this reward come from? from the expired memberships?.

The way it's set right now is that memberships could be expired when we reach the maximum rate limit. The client would then have to find memberships that are expired whose sum of rate limits that will be free once they're expired is enough to allow a registration.

@fryorcraken
Copy link

fryorcraken commented Sep 30, 2024

Interesting and simple approach. Perhaps as part of the solution we should include a "reward" for the person calling eraseMemberships? Otherwise we risk that memberships are never expired?

I think for now, we can expect us (waku team) to run this when needed to help keeping it tidy.

Long term, there is an incentive for any project/application using this smart contract to call this so that their users can join in but it would make sense to have a small rewards indeed. E.g. allocating 1% of RLN fee for this reward.

Copy link

@fryorcraken fryorcraken left a comment

Choose a reason for hiding this comment

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

Offered some idea re error phrasing.

src/Membership.sol Outdated Show resolved Hide resolved
src/Membership.sol Outdated Show resolved Hide resolved
src/Membership.sol Outdated Show resolved Hide resolved
src/Membership.sol Outdated Show resolved Hide resolved
src/Membership.sol Outdated Show resolved Hide resolved
src/Membership.sol Outdated Show resolved Hide resolved
src/Membership.sol Outdated Show resolved Hide resolved
src/Membership.sol Outdated Show resolved Hide resolved
src/WakuRlnV2.sol Outdated Show resolved Hide resolved
src/WakuRlnV2.sol Outdated Show resolved Hide resolved
@richard-ramos richard-ramos force-pushed the feat/membership-notrack branch 3 times, most recently from 79fd7ec to 2b1600a Compare October 7, 2024 19:54
* unify terminology for mdetails
* more DRY in LinearPriceCalculator
* improve terminology consistency (#16)
* refactor, minor fixes
* do not reset ongoing grace period on extension (cf. spec change)
* minor renaming, comments
* refactor, group functions by funcitonality
* extract membership expiration calculation to internal function
* save active duration per membership (must carry over after extension)
* optional lazy erasure from membership set
* minor fixes in tests
* fix: off-by-one: end index can't be equal to next free index
* minor refactoring, comments
* define period boundaries: start inclusive, end exclusive
* separate eraseMembership functions to user-focused (lazy) and admin-focused (tree cleanup)
* minor fix to maintain line lengths
* unify membership-related events
* add test for  zero grace period
* fix typo in comment

Co-authored-by: richΛrd <[email protected]>

---------

Co-authored-by: richΛrd <[email protected]>
@richard-ramos
Copy link
Member Author

@fryorcraken, all your suggestions and doubts should have been applied/answered!

src/Membership.sol Outdated Show resolved Hide resolved
src/Membership.sol Outdated Show resolved Hide resolved
src/Membership.sol Outdated Show resolved Hide resolved
src/WakuRlnV2.sol Outdated Show resolved Hide resolved
src/WakuRlnV2.sol Outdated Show resolved Hide resolved
@richard-ramos richard-ramos merged commit 3fea0a5 into feat/membership Oct 8, 2024
4 checks passed
@richard-ramos richard-ramos deleted the feat/membership-notrack branch October 8, 2024 12:58
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.

4 participants