Skip to content

chore(ic): add flexible message ordering to StateMachine tests#9508

Draft
venkkatesh-sekar wants to merge 15 commits intomasterfrom
vsekar/fmo
Draft

chore(ic): add flexible message ordering to StateMachine tests#9508
venkkatesh-sekar wants to merge 15 commits intomasterfrom
vsekar/fmo

Conversation

@venkkatesh-sekar
Copy link
Member

@venkkatesh-sekar venkkatesh-sekar commented Mar 20, 2026

Adds flexible message ordering to StateMachine for deterministic control over which canister executes which message in each round.

How it works

  • StateMachineBuilder::new().with_flexible_ordering().build() configures scheduler_cores=1, tight round/subnet instruction budgets (1 message per round), and wraps the scheduler with FlexibleOrderingScheduler (priority
    boosting).
  • buffer_ingress_as() buffers ingress messages, execute_with_ordering(MessageOrdering(...)) steps through them.
  • Each step ticks until the message is consumed, handling DTS slices, heartbeats, timers, and management canister loopback pipelines automatically via has_in_flight_work progress detection.

Production code changes

  • SchedulerConfig: added subnet_messages_per_round_instruction_limit field, moved SUBNET_MESSAGES_LIMIT_FRACTION to config as pub.
  • round_schedule.rs: relaxed 3 debug assertions to tolerate scheduler_cores=1.
  • scheduler.rs: uses config field for subnet instruction limit instead of hardcoded formula.

What's NOT covered

  • Multi-subnet / XNet: single subnet only.
  • Heartbeat/Timer as explicit ordering variants: they execute implicitly before input queue messages. The design doc mentions Heartbeat(CanisterId) / Timer(CanisterId) variants — not implemented.

@github-actions github-actions bot added the chore label Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant