🔍 Execution Order and Processor State

Execution Order

By default, handlers are executed in parallel for data belonging to different blocks to achieve maximum performance. The data within a block is processed sequentially.

  • Interval Handlers (e.g., block handlers, time handlers) are always executed at the end of the block. For multiple interval handlers at the same block, the handlers are executed in definition order
  • Event and Function handlers are executed ordered by transaction index
  • Within the same transaction:
    • Function handlers are executed before Event handlers
    • Event handlers are executed by log index

If you want the processor to execute in a fully sequential manner, you can do the following:

import { GLOBAL_CONFIG } from "@sentio/runtime";

GLOBAL_CONFIG.execution = {
  sequential: true,
};

State

DO NOT assume processor in-memory state is restart-safe. Thus, please DO NOT rely on global variables being persistent. As an alternative, use Entity and ctx.store.upsert/get to do that.