go-spacemesh
go-spacemesh copied to clipboard
Hare: message structure violates interface segregation principle
Description
The "unified" message structure in the hare package forces all consumers of the innerMsg struct to understand components that are only relevant for certain messages. In addition, it makes message sizes difficult to predict by simply looking at the code, and makes message validation logic more confusing.
There should be a concise message header that is common to all messages within Hare, and the "innerMsg" or body should just be seen as a byte slice or equivalent by everything that doesn't need to know about it.
https://github.com/spacemeshos/go-spacemesh/issues/3283 will be easier to implement if the message structure is more modular.
Affected code
Pretty much the entire hare package. But really, adding any new messages surrounding hare is a pain in the butt if it doesn't fit the current innerMsg template.
Relates to: https://github.com/spacemeshos/pm/issues/120
This issue appears in commit hash: [ ] will find later
Related files (optionally with line numbers):