Skip to content

v3.6.0

Choose a tag to compare

@DZakh DZakh released this 05 Aug 14:32
· 30 commits to main since this release
9b6d72c

One step closer to truly isolated multichain ⛓️

Per-chain isolation by default (recommended)

Until now, every entity row was shared across every chain, so multichain indexers had to namespace ids by hand: ${event.chainId}_${pool}. This release lets you turn that off:

name: my-indexer
disable_default_cross_chain: true # recommended for all projects, and the default in future HyperIndex v4

With the flag on, entities and effects are scoped per chain. Entity tables get a composite (id, chainId) primary key, so the same id on two chains is two independent rows.

Handlers don't change. A handler always runs on a single chain, so context.Token.get(id) reads that chain's row — and ids no longer need a chain prefix to stay unique.

Opting back into cross-chain

With disable_default_cross_chain: true, you can still share data across chains where you need it. Add @crossChain to an entity, or crossChain: true to an effect:

type Counter {                    # per-chain: one row per (id, chainId)
  id: ID!
  count: BigInt!
}

type GlobalCounter @crossChain {  # one row shared by every chain
  id: ID!
  count: BigInt!
}

Outside a handler there's no chain in context, so Test Indexer operations now take one explicitly: indexer.Counter.set({ id, count, chainId }). indexer.Counter.get(id) throws if the id exists on more than one chain — narrow it with the new indexer.Counter.getWhere({ chainId: { _eq: 1 } }).

By @DZakh in #1531

Other changes

  • Faster pruning of stale entity history by @DZakh in #1531
  • result.changes entries no longer repeat chainId per entity — the change itself carries the chain by @DZakh in #1531
  • getWhere is now available on the test indexer's entity operations by @DZakh in #1531
  • envio init templates drop the ${event.chainId}_ prefix from entity ids, and the bundled indexer skills teach the per-chain convention by @DZakh in #1531

Full Changelog: v3.5.1...v3.6.0