mirror of
https://github.com/logos-messaging/specs.git
synced 2026-01-02 14:13:06 +00:00
edit membership registration section for clarity
This commit is contained in:
parent
258a07ea56
commit
0f9d6804c9
@ -93,7 +93,7 @@ graph TD;
|
||||
GracePeriod -.-> |"time G passed"| Expired;
|
||||
GracePeriod --> |"erase"| ErasedAwaitsWithdrawal;
|
||||
Expired --> |"erase"| ErasedAwaitsWithdrawal;
|
||||
Expired --> |"another membership reuses slot"| ErasedAwaitsWithdrawal;
|
||||
Expired --> |"overwritten by a new membership"| ErasedAwaitsWithdrawal;
|
||||
ErasedAwaitsWithdrawal --> |"withdraw"| Erased;
|
||||
|
||||
```
|
||||
@ -137,32 +137,38 @@ Availability of membership-specific functionalities[^2] MUST be as follows:
|
||||
|
||||
### Register a membership
|
||||
|
||||
Let us define the following aggregate rate limits:
|
||||
- `R_{active}` is the total rate limit of all _Active_ memberships;
|
||||
- `R_{grace_period}` is the total rate limit of all _GracePeriod_ memberships;
|
||||
- `R_{expired}` is the total rate limit of all _Expired_ memberships;
|
||||
- `r` is the requested rate limit of a new membership.
|
||||
|
||||
Let `R_{free} = R_{max} - R_{active} - R_{grace_period} - R_{expired}` be the free rate limit that is available without overwriting _Expired_ slots.
|
||||
|
||||
Membership registration is subject to the following requirements:
|
||||
- If `r <= R_{free}`, the new membership MUST be registered (assuming all other necessary conditions hold). The new membership MAY overwrite one or multiple _Expired_ memberships.
|
||||
- If `r > R_{free}`:
|
||||
- if `r > R_{free} + R_{expired}`, registration MUST fail;
|
||||
- if `r <= R_{free} + R_{expired}`, the new membership MUST be registered by overwriting some _Expired_ memberships.
|
||||
- The sender of the registration transaction MAY specify a list of _Expired_ memberships whose slots will be overwritten. If the list is not provided, the contract MAY use any criteria to select _Expired_ memberships to overwrite (see Implementation Suggestions).
|
||||
- If a new membership A overwrites an _Expired_ membership B:
|
||||
- membership B MUST become _ErasedAwaitsWithdrawal_;
|
||||
- the current total rate limit MUST be decremented by the rate limit of membership B;
|
||||
- the contract MUST take all necessary steps to ensure that the keeper of membership B can withdraw their deposit later.
|
||||
- Registration MUST fail if the requested rate limit for a new membership is lower than `r_{min}` or higher than `r_{max}`.
|
||||
- The keeper MUST specify the requested rate limit `r` of a new membership at registration time[^3].
|
||||
- Registration MUST fail if `r < r_{min}` or `r > r_{max}`.
|
||||
- The keeper MUST lock up a deposit to register a membership.
|
||||
- The keeper MUST specify the rate limit[^3] of a membership at registration time.
|
||||
- The size of the deposit MUST depend on the specified rate limit.
|
||||
- In case of a successful registration:
|
||||
- the new membership MUST become _Active_;
|
||||
- the new membership MUST have an expiration term `T` and a grace period duration `G`;
|
||||
- the current total rate limit MUST be incremented by the rate limit of the new membership.
|
||||
#### Overwriting other memberships
|
||||
|
||||
Let us define the following rate limits:
|
||||
- `R_{active}` is the total rate limit of all _Active_ memberships;
|
||||
- `R_{grace_period}` is the total rate limit of all _GracePeriod_ memberships;
|
||||
- `R_{expired}` is the total rate limit of all _Expired_ memberships.
|
||||
|
||||
Let us define the free rate limit that is available without overwriting _Expired_ memberships as follows:
|
||||
|
||||
```
|
||||
R_{free} = R_{max} - R_{active} - R_{grace_period} - R_{expired}
|
||||
```
|
||||
|
||||
Membership registration is additionally subject to the following requirements:
|
||||
- If `r <= R_{free}`, the new membership MUST be registered (assuming all other necessary conditions hold). The new membership MAY overwrite one or multiple _Expired_ memberships.
|
||||
- If `r > R_{free}`:
|
||||
- if `r > R_{free} + R_{expired}`, registration MUST fail;
|
||||
- if `r <= R_{free} + R_{expired}`, the new membership MUST be registered by overwriting some _Expired_ memberships.
|
||||
- The sender of the registration transaction MAY specify a list of _Expired_ memberships to be overwritten. If the list is not provided, the contract MAY use any criteria to select _Expired_ memberships to overwrite (see Implementation Suggestions).
|
||||
- If a new membership A overwrites an _Expired_ membership B:
|
||||
- membership B MUST become _ErasedAwaitsWithdrawal_;
|
||||
- the current total rate limit MUST be decremented by the rate limit of membership B;
|
||||
- the contract MUST take all necessary steps to ensure that the keeper of membership B can withdraw their deposit later.
|
||||
|
||||
[^3]: A user-facing application SHOULD suggest default rate limits to the keeper (see Implementation Suggestions).
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user