Class ExecutionManager

The ExecutionManager lies at the heart of the t3rn executor. It is responsible for managing and coordinating the execution of incoming XTXs and the corresponding SFXs. It processes incoming events, triggering the creation/execution/confirmation of SFXs.

Hierarchy

  • ExecutionManager

Constructors

Properties

biddingEngine: BiddingEngine
circuitClient: ApiPromise
circuitListener: CircuitListener
circuitRelayer: CircuitRelayer
config: Config
globalConfig: Config
logger: Logger
priceEngine: PriceEngine
prometheus: Prometheus
queue: Queue = ...

Queue used to track SFXs and gateways height

relayers: {
    [key: string]: SubstrateRelayer;
} = {}

Relayer instances for the specific targets

Type declaration

sdk: Sdk
sfxToXtx: {
    [sfxId: string]: string;
} = {}

Maps SFX id to their corresponding XTX id. Used for lookups

Type declaration

  • [sfxId: string]: string
strategyEngine: StrategyEngine
targetEstimator: {
    [id: string]: Estimator;
} = {}

Tx cost estimator instances for the specific targets

Type declaration

xtx: {
    [id: string]: Execution;
} = {}

Maps XTX id to their corresponding Execution instance

Type declaration

Methods

  • Add an incoming bid to the corresponding SFX

    Parameters

    • bidData: ListEventData

      SCALE encoded bid data, as emitted by the circuit

    Returns void

  • Gather and add the required risk/reward parameters for a new SFX.

    Parameters

    Returns Promise<void>

  • Add a new XTX to the execution manager. This is triggered when a new XTX is available on the circuit.

    Parameters

    • xtxData: EventData

      The SCALE encoded XTX data, as emitted by the circuit

    • sdk: Sdk

      The SDK instance

    Returns Promise<void>

  • Update XTX status after it was dropped on circuit. Cleans up queue and updates the SFXs

    Parameters

    • xtxId: string

      Id of XTX that was dropped

    Returns void

  • Trigger the confirmation of SFX that have been executed. When the gateway height is updated, this will check the isConfirming queue for the gateway. The confirmation of any waiting SFXs is now triggered. Requirement for the confirmation is that the circuit has received the corresponding headers, the SFXs where included in.

    Parameters

    • vendor: string

    Returns Promise<void>

  • Initialize all gateways and their corresponding relayers, event listeners and estimators

    Parameters

    Returns Promise<void>

  • Update the queue and SFX state after a confirmation batch was submitted.

    Parameters

    • sfxs: SideEffect[]

      Array of sfx objects

    • batchBlocks: string[]

      Array of block heights of the sfxs where confirmed for. Needed for cleaning up the queue

    • gatewayId: string

      Id of the gateway

    Returns void

  • Update XTX status after it was reverted on circuit. Cleans up queue and updates the SFXs

    Parameters

    • xtxId: string

      Id of XTX that was reverted

    Returns void

  • Setup all instances and listeners for the execution manager

    Parameters

    • gatewayConfig: Gateway[]
    • vendors: string[]

    Returns Promise<void>

  • Initiates a shutdown, the promise resolves once all executions are done.

    Returns Promise<void>

  • Update the vendor height in the queue. This is triggered by an incoming circuit event. Next, this will trigger the confirmation of SFX that have been executed.

    Parameters

    • vendor: string

      Id of the gateway

    • blockHeight: number

      The latest block height

    Returns void

  • Update a XTX status to ready. This is triggered by an incoming circuit event Next, this will trigger the execution of SFX the executor has won the bid on.

    Parameters

    • xtxId: string

      The XTX ID

    Returns Promise<void>

Generated using TypeDoc