elixir-omg icon indicating copy to clipboard operation
elixir-omg copied to clipboard

Watcher Info API may have exits before their respective blocks exist

Open unnawut opened this issue 4 years ago • 1 comments

Continuing from https://github.com/omisego/elixir-omg/pull/1123#discussion_r352586370.

ExitStarted events will go straight to the Consumer without waiting. (the exit_processor listener :point_up:, which will trigger that, doesn't wait for blocks by design, so one cannot just add a waits_for: block_getter there :( ).

Either:

Ensure that the order those events are consumed doesn't matter [to the Info API]"

Let it be. The Info API is eventually consistent and not used for security-critical purposes, so delay between blocks and exits showing up is acceptable.

Maybe, the Bus should be fed events by a dedicated EthereumEventListener that grabs all the events from the contract(s) ... This would provide the consumers with a very well described and predictable behavior - "all events are pushed exactly once at some defined point in time". Then consumers deal with that on their own.

or else...

unnawut avatar Dec 05 '19 18:12 unnawut

Actual error: https://sentry.io/organizations/omisego/issues/1542324859

FunctionClauseError: no function clause matching in Ecto.Changeset.cast/4
  File "lib/ecto/changeset.ex", line 462, in Ecto.Changeset.cast/4
  File "lib/omg_watcher_info/db/eth_event.ex", line 172, in OMG.WatcherInfo.DB.EthEvent.txoutput_changeset/3
  File "lib/omg_watcher_info/db/eth_event.ex", line 156, in OMG.WatcherInfo.DB.EthEvent.insert_exit!/1
  File "lib/enum.ex", line 775, in anonymous fn/3 in Enum.each/2
  File "lib/enum.ex", line 3015, in anonymous fn/3 in Enum.each/2
  File "lib/stream.ex", line 1556, in anonymous fn/3 in Enumerable.Stream.reduce/3
  File "lib/enum.ex", line 3317, in Enumerable.List.reduce/3
  File "lib/stream.ex", line 1568, in Enumerable.Stream.do_each/4

unnawut avatar Mar 02 '20 11:03 unnawut