Clean up message passing between `MessageHub`, `synchronization.Engine` and `compliance.Engine`
Open
Nobody has claimed this yet.
Preserve
S-Consensus
- Dominant language
- Go
- Stars
- 575
- Forks
- 217
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 9
Description
At the moment, message passing between MessageHub, synchronization.Engine and compliance.Engine is untyped, with the following disadvantages:
- it makes it hard to figure out where messages are flowing
- requires repeated, unnecessary type checks
- obfuscates the core logic thereby amplifying the probability of technical debt and edge cases
For examples:
- the
MessageHubcontains code to handle synced blocks, despite the fact that thesynchronization.Enginehands synchronized blocks directly to thecompliance.Engine - Note the compliance engine converts block proposal to functionally exactly the same data structure as a
SyncedBlock.- There is a semantic difference on how we received the block and whom to slash in case the block is invalid. At the moment, we encode this into the data type, despite it representing exactly the same thing (a block).
- To me, it would make more sense, to have the
MessageHuband thesynchronization.Enginefeeding blocks as exactly the same data structure to the compliance engine, but differently-named input methods (e.g.ProcessProposalvsProcessSyncedBlock) - This would be possible without design modifications, because the
MessageHubas well as thesynchronization.Enginealready know the compliance engine directly (we just obfuscate the compliance engine's type unnecessarily)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the message paths in engine/collection/message_hub/message_hub.go, engine/common/synchronization/engine.go, and engine/consensus/compliance/engine.go. Compare the block types with model/events/synchronization.go and inspect the existing compliance-engine entry points. Done means message flow is typed, redundant handling and conversions are removed, and proposal versus synchronized-block semantics remain distinct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- distributed-systems
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100