go-spacemesh icon indicating copy to clipboard operation
go-spacemesh copied to clipboard

Broker allows early messages for type != PreRound

Open gavraz opened this issue 5 years ago • 2 comments

The broker shouldn't allow messages that are not PreRound to be considered as early messages. The only reason we allow it, for now, is because of tests. Some tests may have short rounds which could lead to other messages (status) to appear as early. We should reconsider how to address this point. The two main and simple approaches are:

  1. Allow only PreRound and Status messages
  2. Use round of at least 2 seconds in tests

gavraz avatar Jun 25 '19 14:06 gavraz

A more robust option could be to have an allowed-early-delta that is adjusted based on expected network delay. This way, in tests, as long as the message is received within the allowed early delta, it will be kept for future use.

jonZlotnik avatar Aug 29 '22 19:08 jonZlotnik

Currently, all messages are allowed up to one layer before they’re supposed to be sent

Validate the message contextually: https://github.com/spacemeshos/go-spacemesh/blob/0cb3732b0796ed442366f39ef8cf3909a0c2b48d/hare/broker.go#L246-L266 If message is for the next layer, it's early, otherwise it's late or too far into the future. https://github.com/spacemeshos/go-spacemesh/blob/0cb3732b0796ed442366f39ef8cf3909a0c2b48d/hare/broker.go#L128-L130

If it's early, add it to a pending message inbox which drop messages when it's full. https://github.com/spacemeshos/go-spacemesh/blob/0cb3732b0796ed442366f39ef8cf3909a0c2b48d/hare/broker.go#L280-L302

jonZlotnik avatar Sep 21 '22 18:09 jonZlotnik