You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The chainservice currently has two websocket subscriptions:
Events emitted by the NitroAdjudicator contract
New blocks mined by the chain
The websocket connections frequently (once every couple of hours?) receive errors causing the connection to break, and forcing the chainservice to re-establish the connection. A common error message on those connections is i/o timeout.
We should investigate an alternative approach where the chainservice polls the chain instead of relying on a constant websocket connection. The polling frequency could be set to 0.5-1x the block time to ensure the chainservice does not lag behind too much.
Pros of polling
Simplifies chainservice code substantially. Polling is less prone to many of the race conditions that the current implementation is susceptible to. Switching to polling would allow us to remove lots of logic currently in place to protect against race conditions.
Http requests seem to have a lower failure rate compared to websocket connections. If we switch to polling we could also remove code related to a workaround involving a known issue with the ethereum event subscription.
Http requests targeting the same RPC provider likely scale better than adding additional websocket connections to the same RPC provider
Cons of polling
Less performant (events will be detected later than they are on websockets). However, if the polling frequency is set to 0.5x the block time, we can reduce the maximum delay between event emission and nitro detection to 0.5x the block time (0.5 x 10sec on Filecoin = 5 sec max delay)
The text was updated successfully, but these errors were encountered:
CC: @lalexgap
The
chainservice
currently has two websocket subscriptions:NitroAdjudicator
contractThe websocket connections frequently (once every couple of hours?) receive errors causing the connection to break, and forcing the
chainservice
to re-establish the connection. A common error message on those connections isi/o timeout
.We should investigate an alternative approach where the
chainservice
polls the chain instead of relying on a constant websocket connection. The polling frequency could be set to 0.5-1x the block time to ensure thechainservice
does not lag behind too much.Pros of polling
chainservice
code substantially. Polling is less prone to many of the race conditions that the current implementation is susceptible to. Switching to polling would allow us to remove lots of logic currently in place to protect against race conditions.Cons of polling
The text was updated successfully, but these errors were encountered: