onflow / onflow/flow-go

Clean up message passing between `MessageHub`, `synchronization.Engine` and `compliance.Engine`

Open
#3,545 1 comment 0 reactions 0 assignees View on GitHub

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 MessageHub contains code to handle synced blocks, despite the fact that the synchronization.Engine hands synchronized blocks directly to the compliance.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 MessageHub and the synchronization.Engine feeding blocks as exactly the same data structure to the compliance engine, but differently-named input methods (e.g. ProcessProposal vs ProcessSyncedBlock)
    • This would be possible without design modifications, because the MessageHub as well as the synchronization.Engine already know the compliance engine directly (we just obfuscate the compliance engine's type unnecessarily)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.