aleph-im / aleph-indexer-framework

TypeScript framework for deploying distributed indexers on Aleph VMs for Solana and EVM chains.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enforce type safety between interfaces [Debug Flag]

MHHukiewitz opened this issue · comments

Problem: Debugging the indexer framework is unexpectedly hard due to the multi-threaded microservices architecture. Often, the data being sent around may not conform to the types given in the framework's interface definitions. This comes with two issues:

  1. The transaction data being received by the fetcher does not always conform to the types as expected in the framework. Changes in transaction structure can result in faulty data entering the framework and oftentimes leading to cryptic errors deep inside the framework. See #6.
  2. The same is true for data being passed around the microservices. The problem was first encountered when defining JSON objects' fields such as luxon.DateTime in Pull Request #1.

To improve the debugging process for the indexer framework, I propose the following:

  • adding a flag to enable schema checks on every interface where data is being parsed from JSON.
  • throwing errors every time the data does not conform to the given schema.

I believe this will help debug current issues on the indexer generator and the above PR, as well as future issues.

Tasks:

  • Added flag for strict parsing of incoming txn: #9
  • Enforcing type safety between microservices

Closed in favor of the more specific #19