feat(adkg-cli): rework protocol execution#100
Merged
Conversation
CluEleSsUK
approved these changes
Sep 16, 2025
| use utils::serialize::fq::{FqDeserialize, FqSerialize}; | ||
| use utils::serialize::point::{PointDeserializeCompressed, PointSerializeCompressed}; | ||
|
|
||
| const TOPIC_SWAP_G1_TO_G2: &str = "adkg_dxkr23_swap_g1_to_g2"; |
Contributor
There was a problem hiding this comment.
not relevant for this PR, but will we need to add a nonce to this in a future world where nodes can be a party to many committees?
| // Spawn a task to run the adkg in the background. | ||
| let (tx_adkg_out, rx_adkg_out) = oneshot::channel(); | ||
| let mut adkg_task: tokio::task::JoinHandle<anyhow::Result<()>> = tokio::spawn({ | ||
| let pks = pks.clone(); |
Contributor
There was a problem hiding this comment.
ahh, I like this format of
tokio::spawn({
// clones
async move {
It always felt ugly to read doing the clones outside - we should make this an SOP!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reworks the execution of the ADKG in the cli to fix #96 & fix #97 .
The new execution flow is as follows:
1a. The ADKG has sent an output through the oneshot channel, continue to 2.
1b. The ADKG has timed out, or returned an error => exit now
3.a. The swap protocol completes, write the priv/pub output to the specified files, continue to 4.
3.b. The ADKG task has completed its grace period, continue to 4. <-- The swap protocol has timed out.
The main fix consists of writing into the priv/pub files as soon as we get the ADKG output.
We also now store both the output on the source group, and the output on the swapped group, resulting in a file with the following format:
The attributes suffixed with
_sourceshouldn't be used for applications, but they can be helpful for recovery should the swap protocol ever fail, while the ADKG succeeds.