Skip to content

v1.4.0

Compare
Choose a tag to compare
@pdyraga pdyraga released this 11 Mar 10:03
34905d2

This release implements a major refactoring of Ethereum event subscriptions.

The most important change is the subscription API update allowing installing event callback handler using OnEvent function as well as piping events from a subscription to a channel with Pipe function.

Another important change is a background event monitoring loop. Some Ethereum setups are not particularly reliable in delivering events, events can be dropped randomly and event subscribers may not be aware of the fact they were emitted. To address this problem, we introduce a background loop periodically pulling past events from the chain next to a regular watchLogs subscription. How often events are pulled and how many blocks are taken into account can be configured with SubscribeOpts parameters. This way, even if the event was lost by watchLogs subscription, it should be pulled by a background monitoring loop later. An extremely important implication of this change is that handlers should have logic in place allowing them to de-duplicate received events even if a lot of time passed between receiving the original event and the duplicate.

Additionally, the event resubscription mechanism has been tweaked to apply exponential backoff to resubscribe attempts and to log on ERROR level if the event subscription is not stable enough. This change allowed to use a native resubscription mechanism from go-ethereum and to improve test coverage.

The full set of work that went into the client can be found in the corresponding 1.4.0 milestone.