Stuart meets Satoshi: state machines
Each actor of the key rotation use case has one state machine.
DID controller (Stuart)
Section titled “DID controller (Stuart)”Only one update is in flight. Do not make the next update before the last update has 6 confirmations. Two different
updates with one targetVersionId make the DID fail with LATE_PUBLISHING.
---
title: States of the DID controller (Stuart)
---
%% Rule: only one update is in flight. A new update starts only after the last one has 6 confirmations.
stateDiagram-v2
state "Idle: version N" as Idle
state "Make and sign the update" as Make
state "Announce: Beacon Signal" as Announce
state "Wait for 6 confirmations" as Pending
state "Send the update data to peers" as Send
state "Deactivated" as Deactivated
[*] --> Idle: create the DID (offline)
Idle --> Make: key rotation
Make --> Idle: error
Make --> Announce
Announce --> Announce: aggregation round failed
Announce --> Pending: broadcast
Pending --> Announce: transaction dropped
Pending --> Send: confirmed
Send --> Idle: version N + 1
Send --> Deactivated: the update deactivates the DID
Deactivated --> [*]
Source: states-did-controller.mmd
Aggregation Participant (Stuart)
Section titled “Aggregation Participant (Stuart)”Stuart checks its own entry before it signs. With a k-of-n fallback, a Beacon Signal can go out without the
signature of Stuart. If that signal has a wrong entry for the DID of Stuart, the DID is invalid.
---
title: States of an Aggregation Participant (Stuart)
---
%% CAS Beacon and SMT Beacon cohorts. Signature: all n (n-of-n), or k of n (k-of-n fallback).
stateDiagram-v2
state "Wait for a round" as Wait
state "Send an update or no update" as Respond
state "Check own entry" as Check
state "Sign" as Sign
state "Refuse to sign" as Refuse
state "Keep the round data" as Keep
state "DID invalid" as Invalid
[*] --> Wait: enrolled, Beacon Address checked
Wait --> Respond: round starts
Respond --> Check: entry from the service
Check --> Sign: entry correct
Check --> Refuse: entry wrong
Sign --> Keep: Beacon Signal broadcast
Keep --> Wait
Refuse --> Wait: round fails
Refuse --> Invalid: k-of-n signal with the wrong entry
Wait --> [*]: leave the cohort
Source: states-aggregation-participant.mmd
Aggregation Service
Section titled “Aggregation Service”The Aggregation Service sees hashes only. It needs a response from every participant. It broadcasts the Beacon Signal
with all n signatures, or with k signatures if the cohort has a k-of-n fallback.
---
title: States of the Aggregation Service
---
%% CAS Beacon and SMT Beacon cohorts. The service sees hashes only.
stateDiagram-v2
state "Enroll participants" as Enroll
state "Ready" as Ready
state "Collect responses" as Collect
state "Send the entries for checks" as Build
state "Collect signatures" as Sign
state "Broadcast the Beacon Signal" as Broadcast
state "Round failed" as Failed
[*] --> Enroll: advertise the cohort
Enroll --> Ready: Beacon Address computed
Ready --> Collect: round starts
Collect --> Build: all n responses
Collect --> Failed: a participant does not respond
Build --> Sign
Sign --> Broadcast: n signatures, or k with a fallback
Sign --> Failed: too few signatures
Broadcast --> Ready
Failed --> Ready
Ready --> [*]: cohort closed
Source: states-aggregation-service.mmd
Relying party (Satoshi)
Section titled “Relying party (Satoshi)”Satoshi trusts a new key only if the resolved DID document has it in authentication, and versionId is N or
more. Resolve shows the resolution errors.
---
title: States of the relying party (Satoshi)
---
stateDiagram-v2
state "No trusted key" as Unknown
state "Resolve the DID" as Resolving
state "Trusted: version N" as Trusted
state "Rejected" as Rejected
state "Closed: DID deactivated" as Closed
[*] --> Unknown
Unknown --> Resolving: first contact
Trusted --> Resolving: message with an unknown key
Resolving --> Trusted: key in the DID document
Resolving --> Resolving: data missing, ask Stuart
Resolving --> Rejected: invalid DID or key
Rejected --> Trusted: keep the last trusted keys
Resolving --> Closed: deactivated
Closed --> [*]