pokt-network / pocket

Official implementation of the Pocket Network Protocol v1
https://pokt.network
MIT License
63 stars 33 forks source link

[Consensus] Make interaction among pacemaker and consensus modules asynchronous #428

Open gokutheengineer opened 1 year ago

gokutheengineer commented 1 year ago

Objective

Issue #395 explains necessity of separation of the consensus and pacemaker modules. We can identify two categories on how to do it:

  1. Synchronously: Via calling functions of the consensus module from the pacemaker module. Since we shouldn't use reflect in the production code (except for testing), we need to expose necessary functions of the consensus module. PR https://github.com/pokt-network/pocket/pull/427 follows this methodology.
  2. Asynchronously: Using an event bus to define and send events from pacemaker module to consensus module. This methodology will be more idiomatic than what is implemented in PR https://github.com/pokt-network/pocket/pull/427, since it exposes functions that are internal to the consensus module in shared module. We must seek a way to avoid doing this, and build asynchronous interaction.

Origin Document

I tried to implement asynchronous version first and faced the following problem:

event bus problem

The WIP I made on asynchronous implementation can be found in this branch: https://github.com/pokt-network/pocket/tree/issue/395-WIP-async-decouple-consensus-and-pacemaker-modules

Goals

Deliverable

Non-goals / Non-deliverables

General issue deliverables

Testing Methodology


Creator: @gokutheengineer Co-owner: @Olshansk

Olshansk commented 1 year ago

LGTM, thanks for creating the ticket @gokutheengineer