Closed ameba23 closed 11 months ago
I am planning to move the signing (and DKG) protocol logic, as well has the handshaking and encryption logic, into a separate crate that can be used by both the SDK and server
- so the same code can be called by validator nodes and users to execute the signing and DKG protocols.
The tricky part of this is the different websocket implementations. Already we are using axum::extract::ws
for handling incoming connections, and tokio-tungstenite
for outgoing connections. In wasm we would use the native JS websocket implementation, eg: from bindings provided by the gloo-net
crate.
Since we have channels which relay messages between the encrypted websocket connections and the signing / DKG protocols, one option would be to move the handshaking and encryption logic to the other side of these channels.
The other option is using the Stream
and Sink
traits, or some other trait giving us a way of accessing an arbitrary websocket implementation.
I think for both these options, error handling is going to be the hardest part.
Completed
User participates in signing protocol - Feature Design Notes
Currently the user sends all shares to the threshold servers. In this feature, the user could keep one share to store themselves, and participate in the signing protocol together with the threshold servers.
Things we need:
entropy-core
- A way for the threshold servers to know whether or not the user is a signing party.entropy-core
- A way for the threshold servers to communicate with the user when undertaking the signing protocol.synedrion-wasm
- needs bindings to thesessions
API.entropy-js
a way for the user to execute the signing protocol and communicate with threshold servers.1.
entropy-core
- A way for threshold servers to know whether the user is a signing partyThe simplest way to do this would be that that the user indicates that they are going to participate in signing in a boolean passed in the
UserTransactionRequest
whenever they sign a message.But probably better is if the chain tracks that the user has a key-share. This could be done as follows:
ThresholdServers
is renamed asSigningParties
ServerInfo
is renamed asSigningPartyInfo
and would look like this:On user registration, the relayer pallet
register
function should additionally take a boolean to indicate the user has a keyshare. If true, this function should internally call the staking extention'svalidate
to declare the user as a signing party and store theirSigningPartyInfo
.The staking pallet's
new_session_handler
function would need to check which signing parties are users, and put them in a signing sub-group of their own (containing only the user themselves).A possible problem -
SIGNING_PARTY_SIZE
is declared as a constant. If the user participates we might want more signers, eg: 1 user and 2 validators.2.
entropy-core
- The threshold servers communicate with the user to carry out the signing protocolsubscribe_to_them
)split
the websocket connection into read and write components, and use them to build ourChannels
. To do this we would need to modifyListener
.Channels
which should send and receiveSigningMessage
from the respective read and write halves of the websocket connection, we should not need to modify the rest of the signing client code -execute_sign
should stay just as it is.3.
synedrion-wasm
needs bindings to thesessions
APINeed to cover
make_interactive_signing_session
and its output typeSession<InteractiveSigningState>
.4.
entropy-js
- the user executes the signing protocol and communicates with threshold serversregister
method, we need to indicate whether or not we have stored a share locally.sign
method. If a key-share is passed, we need to open a websocket connection to each threshold server, callmake_interactive_signing_session
, and relay messages between theSession
and our set of websocket connections.