Evaluate FSM support for mediation and parallel trade flows
Goal
Investigate how the FSM can better represent mediation alongside the normal trade flow, using the MuSig custom payout implementation as a concrete example.
Make clear which activities can progress independently, which decisions make settlement paths mutually exclusive, and how completion through one path affects the others.
Areas to investigate
-
Parallel progress: How should trade progress and mediation progress be represented without adding a trade state constant for every possible combination?
-
Coordination between flows: When should accepting or signing a mediation result prevent normal cooperative closure? How should an observed closure end the remaining flow?
-
Asynchronous events and races: How should late, duplicate, or out-of-order messages be handled when the traders have different local states, for example, one starts custom payout while the other starts normal closure?
-
Shared behavior: How can mediation handling work consistently across relevant trade states and buyer/seller, maker/taker protocols? Which coordination belongs in the FSM and which belongs in services?
-
Modelling options: Would hierarchical states and parallel regions in statecharts express these relationships more clearly, or would focused improvements to the existing FSM be sufficient?
Expected outcome
Document the required behavior, compare suitable approaches, and propose incremental implementation steps with tests for the important interactions and race conditions.
Evaluate FSM support for mediation and parallel trade flows
Goal
Investigate how the FSM can better represent mediation alongside the normal trade flow, using the MuSig custom payout implementation as a concrete example.
Make clear which activities can progress independently, which decisions make settlement paths mutually exclusive, and how completion through one path affects the others.
Areas to investigate
Parallel progress: How should trade progress and mediation progress be represented without adding a trade state constant for every possible combination?
Coordination between flows: When should accepting or signing a mediation result prevent normal cooperative closure? How should an observed closure end the remaining flow?
Asynchronous events and races: How should late, duplicate, or out-of-order messages be handled when the traders have different local states, for example, one starts custom payout while the other starts normal closure?
Shared behavior: How can mediation handling work consistently across relevant trade states and buyer/seller, maker/taker protocols? Which coordination belongs in the FSM and which belongs in services?
Modelling options: Would hierarchical states and parallel regions in statecharts express these relationships more clearly, or would focused improvements to the existing FSM be sufficient?
Expected outcome
Document the required behavior, compare suitable approaches, and propose incremental implementation steps with tests for the important interactions and race conditions.