Skip to content

Commit

Permalink
clean up messages and add packet to net mod; first pass state_machine…
Browse files Browse the repository at this point in the history
… mod
  • Loading branch information
xoloki committed Sep 27, 2023
1 parent a82928a commit d45783f
Show file tree
Hide file tree
Showing 4 changed files with 899 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ p256k1 = "5.4"
serde = { version = "1.0", features = ["derive"] }
sha2 = "0.10"
thiserror = "1.0"
tracing = "0.1.37"

[dev-dependencies]
criterion = "0.5.1"
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ pub mod errors;
pub mod net;
/// Schnorr utility types
pub mod schnorr;
/// State machines
pub mod state_machine;
/// Functions for doing BIP-340 schnorr proofs and other taproot actions
pub mod taproot;
/// Traits which are used for v1 and v2
Expand Down
12 changes: 10 additions & 2 deletions src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ pub enum DkgStatus {
#[derive(Clone, Serialize, Deserialize, Debug)]
/// Encapsulation of all possible network message types
pub enum Message {
/// Tell signers to begin DKG
/// Tell signers to begin DKG by sending DKG public shares
DkgBegin(DkgBegin),
/// Send DKG public shares
DkgPublicShares(DkgPublicShares),
/// Tell signers to send DKG private shares
DkgPrivateBegin(DkgBegin),
/// Send DKG private shares
DkgPrivateShares(DkgPrivateShares),
/// Tell coordinator that DKG is complete
Expand All @@ -64,7 +66,7 @@ pub enum Message {
/// Tell coordinator signing nonces
NonceResponse(NonceResponse),
/// Tell signers to construct signature shares
SigmatureShareRequest(SignatureShareRequest),
SignatureShareRequest(SignatureShareRequest),
/// Tell coordinator signature shares
SignatureShareResponse(SignatureShareResponse),
}
Expand Down Expand Up @@ -267,3 +269,9 @@ impl Signable for SignatureShareResponse {
}
}
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct Packet {
pub msg: Message,
pub sig: Vec<u8>,
}
Loading

0 comments on commit d45783f

Please sign in to comment.