distributed state machine