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

fix DKG test #428

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions coordinator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ edition = "2021"
async-trait = "0.1.83"
derivative = "2.2.0"
eyre = "0.6.12"
frost-core = { version = "2.0.0", features = ["serde"] }
frost-rerandomized = { version = "2.0.0-rc.0", features = ["serde"] }
frost-ed25519 = { version = "2.0.0", features = ["serde"] }
reddsa = { git = "https://github.com/ZcashFoundation/reddsa.git", rev = "ed49e9ca0699a6450f6d4a9fe62ff168f5ea1ead", features = ["frost", "serde"] }
# frost-core = { version = "2.0.0", features = ["serde"] }
# frost-rerandomized = { version = "2.0.0-rc.0", features = ["serde"] }
# frost-ed25519 = { version = "2.0.0", features = ["serde"] }
# reddsa = { git = "https://github.com/ZcashFoundation/reddsa.git", rev = "ed49e9ca0699a6450f6d4a9fe62ff168f5ea1ead", features = ["frost", "serde"] }
frost-core = { path = "/home/conrado/zfnd/frost/frost-core", features = ["serde"] }
frost-ed25519 = { path = "/home/conrado/zfnd/frost/frost-ed25519", features = ["serde"] }
frost-rerandomized = { path = "/home/conrado/zfnd/frost/frost-rerandomized", features = ["serde"] }
reddsa = { path = "/home/conrado/zfnd/reddsa", features = ["frost"] }
hex = { version = "0.4", features = ["serde"] }
thiserror = "2.0"
rand = "0.8"
Expand Down
16 changes: 13 additions & 3 deletions dkg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
async-trait = "0.1"
eyre = "0.6.12"
frost-core = { version = "2.0.0", features = ["serde"] }
frost-ed25519 = { version = "2.0.0", features = ["serde"] }
reddsa = { git = "https://github.com/ZcashFoundation/reddsa.git", rev = "ed49e9ca0699a6450f6d4a9fe62ff168f5ea1ead", features = ["frost"] }
# frost-core = { version = "2.0.0", features = ["serde"] }
# frost-ed25519 = { version = "2.0.0", features = ["serde"] }
# reddsa = { git = "https://github.com/ZcashFoundation/reddsa.git", rev = "ed49e9ca0699a6450f6d4a9fe62ff168f5ea1ead", features = ["frost"] }
frost-core = { path = "/home/conrado/zfnd/frost/frost-core", features = ["serde"] }
frost-ed25519 = { path = "/home/conrado/zfnd/frost/frost-ed25519", features = ["serde"] }
reddsa = { path = "/home/conrado/zfnd/reddsa", features = ["frost"] }
clap = { version = "4.5.23", features = ["derive"] }
hex = { version = "0.4", features = ["serde"] }
thiserror = "2.0"
Expand All @@ -18,6 +22,12 @@ serde_json = "1.0"
itertools = "0.13.0"
exitcode = "1.1.2"
pipe = "0.4.0"
frostd = { path = "../frostd" }
participant = { path = "../participant" }
xeddsa = "1.0.2"
reqwest = { version = "0.12.9", features = ["json"] }
tokio = { version = "1", features = ["full"] }
snow = "0.9.6"

[features]
default = []
69 changes: 69 additions & 0 deletions dkg/src/args.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,77 @@
use std::sync::Arc;

use clap::Parser;
use frost_core::{Ciphersuite, Identifier};

#[derive(Parser, Debug, Default)]
#[command(author, version, about, long_about = None)]
pub struct Args {
#[arg(short = 'C', long, default_value = "ed25519")]
pub ciphersuite: String,
}

#[derive(Clone)]
pub struct ProcessedArgs<C: Ciphersuite> {
/// CLI mode. If enabled, it will prompt for inputs from stdin
/// and print values to stdout, ignoring other flags.
pub cli: bool,

/// HTTP mode. If enabled, it will use HTTP communication with a
/// FROST server.
pub http: bool,

/// IP to connect to, if using HTTP mode.
pub ip: String,

/// Port to connect to, if using HTTP mode.
pub port: u16,

/// The participant's communication private key for HTTP mode.
pub comm_privkey: Option<Vec<u8>>,

/// The participant's communication public key for HTTP mode.
pub comm_pubkey: Option<Vec<u8>>,

/// A function that confirms that a public key from the server is trusted by
/// the user; returns the same public key. For HTTP mode.
// It is a `Rc<dyn Fn>` to make it easier to use;
// using `fn()` would preclude using closures and using generics would
// require a lot of code change for something simple.
#[allow(clippy::type_complexity)]
pub comm_participant_pubkey_getter:
Option<Arc<dyn Fn(&Vec<u8>) -> Option<Vec<u8>> + Send + Sync>>,

/// The threshold to use for the shares
pub min_signers: u16,

/// The total number of signers. Only needed for CLI mode.
pub max_signers: Option<u16>,

/// The list of pubkeys for the other participants. This is only required
/// for the first participant who creates the DKG session.
pub participants: Vec<Vec<u8>>,

/// Identifier to use for the participant. Only needed for CLI mode.
pub identifier: Option<Identifier<C>>,
}

impl<C> ProcessedArgs<C>
where
C: Ciphersuite,
{
pub(crate) fn new(config: &crate::inputs::Config<C>) -> Self {
Self {
cli: true,
http: false,
ip: String::new(),
port: 0,
comm_privkey: None,
comm_pubkey: None,
comm_participant_pubkey_getter: None,
min_signers: config.min_signers,
max_signers: Some(config.max_signers),
participants: Vec::new(),
identifier: Some(config.identifier),
}
}
}
Loading