Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre-share nonces #218

Merged
merged 18 commits into from
Nov 16, 2023
Merged

Pre-share nonces #218

merged 18 commits into from
Nov 16, 2023

Conversation

agouin
Copy link
Member

@agouin agouin commented Nov 14, 2023

Main objective

make Horcrux fast enough for 100% uptime on chains with sub-second blocks. This should be possible with reasonable pings between cosigners (<100ms), e.g. dYdX, Neutron, Injective, Sei.

Nonce pre-generation and pre-sharing

Remove a round trip to the cosigners from each sign request!

Nonces can be pre-shared so they are ready for the time of signature, reducing the sign time to <2ms per signature under ideal network conditions.

CosignerHealth is in operation when a cosigner is the leader. It pings other cosigners every second and tracks the round-trip-time (RTT). It has a method GetFastest to get the peer cosigners in order of lowest to highest RTT.

CosignerNonceCache stores the pre-shared nonces and which Cosigners were involved in the pre-generation of that nonce. Any nonces which do not have threshold number of cosigners involved in pre-generation are not stored.

GRPC multiplexing

Raft finally has a LeaderWithID() function, so we can look up the *RemoteCosigner from the ID rather than having to make a separate grpc client to the leader address, so we can use grpc multiplexing for proxy sign operations.

*RemoteCosigner now opens a consistent connection to take advantage of HTTP/2 multiplexing for Cosigner<->Cosigner communication.

@agouin agouin marked this pull request as ready for review November 15, 2023 17:23
@agouin agouin requested a review from misko9 November 15, 2023 17:23
signer/local_cosigner.go Outdated Show resolved Hide resolved
@agouin agouin merged commit 73350e2 into main Nov 16, 2023
13 checks passed
@agouin agouin deleted the andrew/pre_share_nonces branch November 16, 2023 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants