Skip to content

Testing: implement deterministic protocol state-machine tests #103

Description

@josephchimebuka

Summary

Add state-machine test suite that models legal and illegal transitions across protocol lifecycle actions.

Why this change matters

Round protocols are inherently stateful. State-machine tests prevent accidental transition bugs (e.g., resolve before end, recreate while active, claim semantics drift) and improve confidence during refactors.

Where to work

  • contracts/src/tests/ (new state-machine module)
  • possible helpers in test utilities for reusable transition setup

What contributors should implement

  1. Define allowed states and transitions for each mode.
  2. Encode both success and rejection transitions.
  3. Validate persistence and event side-effects after each step.
  4. Include regression cases from historical bugs.

Acceptance Criteria

  • Transition graph is documented in test module.
  • Illegal transitions consistently return expected errors.
  • Tests cover both Up/Down and Precision modes.

Final result should look/feel like

The protocol lifecycle is test-documented as a contract of behavior, making future changes safer and easier to review.

Difficulty

intermediate

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions