Summarized from: https://discord.com/channels/973324189794697286/1526567789803081728/1526942404614164571

Fix: ‣

We saw Waittickets with ticketWaitFor=0, which doesn’t really make sense. This seems to happen after retries: the registrar recomputes tWait, then calls updateWaitAfterRetry, which subtracts now - ticket.tInit.

Current flow is something like:

  1. Initial waitingTime() rounds the computed wait to whole seconds.
  2. updateWaitAfterRetry() can produce a positive remaining wait time below one second.
  3. The code treats any tWait > 0 as Wait(ticket).
  4. Ticket encoding serializes Duration using .seconds, so a sub-second tWaitFor becomes 0.
  5. Ticket timestamps (tInit, tMod) are serialized as epoch seconds, but validation compares ticket.tMod + ticket.tWaitFor + registrationWindow against Moment.now() that has more precision.
  6. With registrationWindow=1s, the retry window depends on where inside the second the ticket was created. ie: a ticket created at 12:00:01.943 is serialized with tMod=12:00:01, so the validation window can be shortened by almost a full second. Combined with tWaitFor=0, retries can be rejected as late.

Questions:

It would be nice to sync in what is the intended protocol behavior for remaining waits that are below a second? ie:

Also: