-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor listener; add flush #58
Conversation
stream, sub, history, err = etherReader.QueryWithHistory(ctx, &query) | ||
if err != nil { | ||
logger.Error("Unable to subscribe to logs", "attempt", queryAttempt, "err", err) | ||
queryAttempt++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if queryAttempt gets above a certain number should this ever panic? or just a descriptor for logging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thinking here is that if for some reason the websocket is offline and it was unable to subscribe to logs, we should continue relaying and flushing other paths.
This would be a good place to add prometheus metrics so that an infra team can be notified about these errors.
This PR solves several issues.
Introduce reoccurring flush
The
start
command not accepts a--flush-interval
or-i
flag and takes a duration.The relayer now tracks the "last-flushed-block".
When a flush interval is set:
The relayer will continuously look back
last-flushed-block - lookback period up to the latest block
and perform a flush.(
last-flushed-block - lookback period
may be overkill? Potentially just flushlast-flushed-block up to latest block
?)Handle disconnected ETH web sockets
Prior to this PR, if an ETH/L2 web socket was disconnected, the relayer would crash. We relied on the infrastructure the relayer was deployed in to restart it. We now handle disconnections gracefully picking up where it left off.
This will also:
Allow for larger ETH/L2 history queries
Depending on your ETH/L2 node or provider, you are only able to query a certain amount of history at once (we were running into this issue specifically with Avalanche). Now all ETH/L2 history queries are blocked in chunks of 100 blocks at a time.
Better handling of Clients and Cosmos Providers
This PR introduces
InitializeClients()
andCloseClients()
to the chain interface. This allows for better handling of clients/providers and allows for an organized cleanup in the event of a termination.