gnosisguild/enclave

Sync event state (tracking)

Opened this issue · 1 comments

Currently we have a realtime system which responds to realtime events from the EVM as they are broadcast but we need to be able to collect historical events in an actor from both the eth_getFilterLogs as well as eth_subscribe for future / live events. Which should be committed to disk.

We can change the stream_from_evm function to become an actor that is sent requests to forward to the bus and utilize hydration as referenced within the persistence issue however we will need to store an offset at which events are streamed as part of this actor.

Also we need to event source the event bus and ensure we have processed past events correctly and are up to date.


WIP Sync scenarios

Scenario: New node comes online

  1. The node will need to register itself as online
  2. The node will ask the contract for all historical ciphernode events in order to be able to determine it's place within CN sortition
  3. The node has not been part of the network and as a consequence need not take part in any decryptions

Scenario: Node restart / network disruption

  1. Node that has been online has a temporary disruption that lasts a few minutes
  2. Node needs to ask network for all recent events from the period of time they have missed for this they broadcast an event request with an event_id of the last event they received.

Just incase it is not clear there are two parts of this this issue the first which is complete accounts for catching up on on-chain events the second accounts for catching up and managing peer events.