enviodev / hyperindex

📖 Blazing-fast multi-chain indexer
https://envio.dev
78 stars 6 forks source link

Update sync state and raw events regardless of handler registration #321

Closed JonoPrest closed 2 weeks ago

JonoPrest commented 3 weeks ago

A quick one to close #282

This actually is a small bug for restarts in an edgecase described below, also I think it's an improvement.

Before this change, an event that doesn't have a handler registered (even if it has a contractRegister instead)

  1. does not count towards number of events processed on UI
  2. does not increment event sync state table (this should be atomic and it's what gets read on restarts)
  3. does not add the event to raw_events table (when it's configured to)

The edgecase bug this can cause is if the last event processed had only a contractRegister function. The event sync state will not increase and on a restart it would then include the event that had already been processed. There should be no crash or double processing though since it would only have a contractRegister function and this is already protected against double registrations.