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

17/WAKU2-RLN-RELAY: clarify definitions of period and epoch #89

Open
s-tikhomirov opened this issue Aug 30, 2024 · 0 comments
Open

17/WAKU2-RLN-RELAY: clarify definitions of period and epoch #89

s-tikhomirov opened this issue Aug 30, 2024 · 0 comments

Comments

@s-tikhomirov
Copy link

s-tikhomirov commented Aug 30, 2024

Consider this section from the 17/WAKU2-RLN-RELAY spec:

The messaging rate is defined by the period which indicates how many messages can be sent in a given period. We define an epoch as ⌈ unix_time / period ⌉. For example, if unix_time is 1644810116 and we set period to 30, then epoch is ⌈ (unix_time/period) ⌉ = 54827003.

From this definition, an epoch is an integer. If so, the following sentense doesn't type-check:

...only allowed to send one message per epoch

I see some clarity issues here: the term "Unix epoch" can be understood in different ways: a) the current Unix timestamp; b) midnight UTC 1-Jan-1970; c) the time period from midnight UTC 1-Jan-1970 into infinity (or until a new time standard is adopted).

What I would suggest:

  1. define epoch number as ⌈ unix_time / period ⌉.
  2. define epoch as the time interval between unix_time and unix_time + period, where unix_time is a unix timestamp divisible by period (think carefully about boundaries being inclusive / non-inclusive).
  3. define rate limits in terms of "N messages per epoch" as currently done.

Further:

NOTE: The epoch refers to the epoch in RLN and not Unix epoch. This means a message can only be sent every period, where the period is up to the application.

Note that there is a distinction between "a message can only be sent every period" and "a message can only be sent every epoch". Consider a period of 10 seconds and a rate limit of 1 message every period. Epoch 1 contains timestamps 1-10, and epoch 2 contains timestamps 11-20. Consider two messages sent at timestamps 9 and 11. By period-based rate limit, this is not allowed, but by epoch-based rate limit it is allowed, as these messages fall into different epochs.

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

No branches or pull requests

1 participant