Skip to main content

Types and Enums

Source of truth: src/qtg/domain/types.py, src/qtg/domain/states.py Public re-export: src/qtg/domain/__init__.py
The QTG v3 domain layer defines all classification values as enum.StrEnum. They are stored as strings in the DB and referenced as type-safe enums in Python code. This document explains every enum defined in the domain.

Table of Contents

  1. TransportFamily
  2. VenueType
  3. ChainFamily
  4. CompletionAssurance
  5. NodeKind
  6. EdgeType
  7. GraphShape
  8. PlanTemplateStatus
  9. ApprovalStatus
  10. ReservationStatus
  11. CallbackOutboxStatus
  12. RequestState / NodeState

TransportFamily

Top-level classification of transfer method. At the plan-template level, it determines which transport path is used.

Usage

  • transport classification for plan templates (used in future routing decisions)
  • lane separation in executor selection logic

VenueType

Type of venue where funds are located.

Usage

  • source/destination venue classification in intent
  • filtering eligible plan templates by the source_venue_type + destination_venue_type combination during routing decisions

ChainFamily

Blockchain network family. Signing scheme, RPC interface, and address format are consistent within a family.

Usage

  • SignerRegistryEntry.chain_families (JSON array) — list of chain families supported by the signer
  • SigningIntent.chain_family — specifies the chain family in the signing request
  • decides chain-specific RPC call behavior inside executors

CompletionAssurance

Assurance level required for a node/request to be considered “complete.” It indicates how deep the verification goes.

Usage

  • MovementPlanVersion.completion_policy (JSON) — plan-level completion policy
  • MovementRequest.completion_policy_snapshot — snapshot taken when the request is created
  • used to decide how far observe nodes should execute

Assurance-level hierarchy

The higher the required assurance level, the more observe nodes are included in the plan graph.

NodeKind

Classification of node roles within the plan graph. It is a core distinction in the v3 architecture and directly affects executor selection and state-transition strategy.

Importance of the action vs observe distinction

This distinction directly affects the system’s safety model:
  1. has_side_effect decision: action nodes are typically set to has_side_effect=True. This flag determines the FAILED vs MANUAL_INTERVENTION judgment in state derivation. (See states-and-transitions.md for details.)
  2. Whether signing is required: action nodes may have signing_required=True (especially on-chain tx). observe nodes do not require signing.
  3. Meaning of UNKNOWN state: UNKNOWN on an action node means a fund movement may have happened. UNKNOWN on an observe node means only that the lookup failed.
  4. Recovery strategy: action UNKNOWN -> attempt txid confirmation from the provider. observe UNKNOWN -> simple retry.

manual_gate behavior

  • If there is a READY node whose node_key starts with the manual_ prefix
  • and there are no other active execution nodes
  • derive_request_state() returns WAITING_MANUAL_ACTION
  • when the operator clears the manual gate through the API, the request returns to EXECUTING

DB usage

  • MovementPlanNode.node_kind (String(32)) — plan node definition
  • ExecutionContext.node_kind — passed into execution context

EdgeType

Type of connection (edge) between nodes in the plan graph. It determines under which condition the transition moves to the next node.

DB usage

  • MovementPlanEdge.edge_type (String(32))
  • MovementPlanEdge.from_node_idMovementPlanEdge.to_node_id
  • MovementPlanEdge.condition_expr — additional conditional expression (optional)
  • MovementPlanEdge.priority — priority among the same edge_type

Role in Frontier Advancement

Currently, advance_after_completion() looks up successors of the completed node through get_successor_keys(). Branching logic by edge type is planned for graph_runtime (in v3.0, only the on_success path is active).

GraphShape

Topology shape of the plan graph. Determined at compile time and used to judge runtime requirements.

DB usage

  • MovementPlanVersion.graph_shape (Enum) — plan-version level
  • MovementPlanVersion.requires_graph_runtime (Boolean) — True when not LINEAR

v3.0 executability

The v3.0 runtime can execute only LINEAR graphs. BRANCHING, MERGING, SPLIT, and HYBRID require graph runtime and are marked with MovementPlanVersion.executable_in_v3_0 = False. This constraint is propagated to MovementRequest as well.

PlanTemplateStatus

Lifecycle state of a plan template.

DB usage

  • MovementPlanTemplate.status (Enum, default=draft)

ApprovalStatus

Approval state of a request.

DB usage

  • MovementRequest.approval_status (Enum, default=pending)
  • Tracked separately from RequestState. When RequestState transitions from PENDING_APPROVAL to APPROVED, approval_status also changes to approved.

ReservationStatus

State of hardcap reservation (resource reservation).

DB usage

  • MovementRequest.reservation_status (Enum, default=none)

Detailed release conditions

Based on the should_release_reservation() function: Based on should_release_reservation():
  • REJECTED, EXPIRED -> always released
  • CANCELLED, FAILED -> released only when there is no side-effect-bearing COMPLETED node
  • if a side-effect-completed node exists -> do not release (funds are in transit)

CallbackOutboxStatus

Delivery state of a callback outbox message.

DB usage

  • MovementCallbackOutbox.status (Enum, default=pending)
  • MovementCallbackOutbox.max_attempts (default=5)
  • MovementCallbackOutbox.attempts — current attempt count

RequestState / NodeState

Detailed descriptions of the state enums are organized in states-and-transitions.md. This section records only their location and re-export information.
  • Defined in: src/qtg/domain/states.py
  • Re-export: qtg.domain.RequestState, qtg.domain.NodeState
  • RequestState: 12 values (RECEIVED, VALIDATED, PENDING_APPROVAL, APPROVED, EXECUTING, WAITING_MANUAL_ACTION, COMPLETED, FAILED, MANUAL_INTERVENTION, REJECTED, EXPIRED, CANCELLED)
  • NodeState: 12 values (BLOCKED, READY, PREPARING, AWAITING_SIGNATURE, SUBMITTING, SUBMITTED, OBSERVING, COMPLETED, FAILED, UNKNOWN, CANCELLED, SKIPPED)

Full enum import path

All domain enums can be imported directly from qtg.domain:
domain/__init__.py re-exports all public types through __all__.

DB column mapping summary

NodeKind and EdgeType are stored in the DB as String, not SQLAlchemy Enum. Python code uses StrEnum, but at the DB-schema level only string constraints apply.

Cross-References