Polkassembly Logo

Create Pencil IconCreate
OpenGov

Notice: Polkadot has migrated to AssetHub. Balances, data, referenda, and other on-chain activity has moved to AssetHub.Learn more

View All Discussion

Acuity Index: omni-indexer

userjbrown
5 months ago
Development

Full proposal: https://index.acuity.network/proposals/2/

Currently Acuity Index works by decoding each event into a Rust type that has been generated automatically by the subxt macro by calling EventDetails::as_root_event()

This has a number of problems. Currently event types are only derived for the latest runtime for each chain. If events have been modified or removed during chain upgrades the latest version of the indexer may not be able to index certain events from older blocks.

One solution to this would be to derive event types and maintain indexing macros for all runtimes that a chain has had. The burden of maintaining the indexer for each chain would be large and complex.

During build the subxt macro is extremely slow and requires a considerable amount of RAM. Running it for every individual runtime would increase the build requirements considerably making maintenance even harder.

Converting the event into dedicated types also increases the CPU time required during indexing.

Consumers of the index (dapps) typically will not want to decode events into runtime-specific types. This would add to the complexity and maintenance burden of the dapp.

It is unusual for the schema of an individual event to change over a runtime upgrade. Typically events are added or removed.

A much better approach is to call EventDetails::field_values()

This has a number of advantages:

  • separate indexers do not need to be built for each chain
  • macros do not need to be written for custom pallets
  • chain indexing can be specified in a simple TOML file
  • a single specification can handle indexing all of a chain's runtime versions
  • decoded parameters for each individual event can be stored and returned in query results

A chain index specification will include the following config items:

  • name
  • genesis hash
  • list of block numbers where index updates have occured - re-indexing will occur as necessary upon upgrade of Acuity Index or index specification
  • default full node url
  • Polkadot SDK version - Acuity Index must be updated to support it
  • for each current or historic pallet either specify:
    • default for Polkadot SDK built-in pallets
    • custom for each event variant specify which parameters should be indexed by which key

Full proposal: https://index.acuity.network/proposals/2/

Comments (0)

PleaseLogin to comment

Help Center

Report an Issue
Feedback
Terms and Conditions
Github

Our Services

Docs
Terms of Website
Privacy Policy

A House of Commons Initiative.

Polka Labs Private Limited 2025

All rights reserved.

Terms and ConditionsTerms of Website
Privacy Policy