tangle-network / cggmp-threshold-ecdsa

MPC protocols for threshold ECDSA
GNU General Public License v3.0
47 stars 10 forks source link

[SPEC] Key Refresh (fs-dkr) State Machine (in progress) #5

Closed akileshtangella closed 1 year ago

akileshtangella commented 2 years ago

Very high level overview of fs-dkr

Main takeaway from the above section:

State Machine for GG '20

What is a state machine?

Contextualizing w.r.t. GG '20. The KeyGen struct makes up the state space, message space, and transition function for each party. Let's be more specific:

Basically things work as follows. The handle_incoming function on the StateMachine trait adds a message to a message store. Once the store is filled (a.k.a. the messages have been received from all parties), the state machine is ready to transition state via the proceed function, since it has access to the full message.

State Machine for fs-dkr

Round 0

The initial state will be an Option<LocalKey<Secp256k1>>. If this Option is None then it corresponds to a newly joining party and if it corresponds to an already existing party.

pub struct Round0 {
    local_key: Option<LocalKey<Secp256k1>>
}

Round 0 -> Round 1

The proceed transition from round 0 to round 1 does not entail receiving any messages. Rather the state transition works as follows:

The round 1 struct looks like:

pub struct Round1 {
    local_key: LocalKey<Secp256k1>,
...
}

Notice here local_key is no longer an Option since every party has generated their local keys.

Round 1 -> Round 2

The transition from round 1 to round 2 entails receiving BroadcastMsgs<Option<JoinMessage>> as the messages. The proceed transition function receives these messages and:

The round 2 state looks like:

pub struct Round2 {
    local_key: LocalKey<Secp256k1>,
...
}

...with the updated local_keys.

Round 2 -> Final Output

Each party receives BroadcastMsgs<Option<RefreshMessage>> does the relevant checks and updates its local_key accordingly. The final state is a new LocalKey.

Todos for implementation