bryanlabs/cosmos-indexer-sdk

Research developer requirements for custom module indexer implementations

Closed this issue · 1 comments

We need to do research around the following:

  1. Which custom modules are of interest to indexer developers across the Cosmos SDK chains?
  2. What is the best way to bring protos into the probe codec? Either:
    • Proto code gen + Message type extension
    • Fork of modules and clear out of non-message type code implementations to slim it down

Requirements for Probe Codec Message Type Extension

Developers need to be able to register custom message types into the Probe codec. This should be relatively opaque, i.e. it should be very simple to register custom message types in the Indexer at a unique message type URL.

Requirements

  1. Developers should be able to register custom message types in the Indexer at a unique message type URL.
  2. This process should be simple and opaque, it should not require developers to understand the internals of the Probe codec.
  3. The Indexer should be able to decode custom message types registered in the Probe codec.

Implementation

Initial Entrypoint: Register Function on the Indexer Type that Modifies the Probe Codec at Index Command Execution

The initial entrypoint for registering custom message types in the Probe codec should be a function on the Indexer type that modifies the Probe codec at the time of Index command execution. This function should be called by the Index command when it is executed.

This will fit the basic behavior already implemented in the Indexer, where developers can register various components of the Indexer before the Index command is executed.

This entrypoint should take a map of message type URLs to structs that satisfy the Cosmos SDK Msg interface. This map should be used to register the custom message types in the Probe codec.

Register Custom Message Types in the Probe Codec

The function that initializes the Probe ChainClient should be modified to register the custom message types in the Probe codec. This function should take the map of message type URLs to structs that satisfy the Cosmos SDK Msg interface and register them in the Probe codec.

It should also do some basic validation to ensure that the message type URLs are unique based on what has already been registered in the Probe codec, which means that this registration should be done after the default message types have been registered and before the Index command is executed.