Skip to content

Commit

Permalink
PoC embedding dkg shares into begin messages
Browse files Browse the repository at this point in the history
fmt fixes

remove commented out branches
  • Loading branch information
xoloki committed Nov 25, 2024
1 parent a474a56 commit 3f8be89
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 45 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion signer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ tracing-attributes.workspace = true
tracing-subscriber = { workspace = true, features = ["json", "fmt"]}
url.workspace = true
# wsts.workspace = true
wsts = { git = "https://github.com/Trust-Machines/wsts.git", rev = "ebd7d7775ad5e44cdbf4f5c1fb468bdf6c467265" }
wsts = { git = "https://github.com/Trust-Machines/wsts.git", rev = "c90232f929e1433f0eac8175512541be32d4e2c0" }
zeromq.workspace = true
hex.workspace = true
cfg-if = "1.0"
Expand Down
1 change: 1 addition & 0 deletions signer/src/testing/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ impl fake::Dummy<fake::Faker> for message::WstsMessage {
dkg_id: config.fake_with_rng(rng),
signer_ids: config.fake_with_rng(rng),
key_ids: config.fake_with_rng(rng),
dkg_private_shares: Default::default(),
};

Self {
Expand Down
47 changes: 4 additions & 43 deletions signer/src/transaction_signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,48 +518,6 @@ where
self.relay_message(msg.txid, &msg.inner, bitcoin_chain_tip)
.await?;
}
WstsNetMessage::DkgPublicShares(dkg_public_shares) => {
tracing::info!(
signer_id = %dkg_public_shares.signer_id,
"handling DkgPublicShares",
);
let public_keys = match self.wsts_state_machines.get(&msg.txid) {
Some(state_machine) => &state_machine.public_keys,
None => return Err(Error::MissingStateMachine),
};
let signer_public_key = match public_keys.signers.get(&dkg_public_shares.signer_id)
{
Some(key) => PublicKey::from(key),
None => return Err(Error::MissingPublicKey),
};

if signer_public_key != msg_public_key {
return Err(Error::InvalidSignature);
}
self.relay_message(msg.txid, &msg.inner, bitcoin_chain_tip)
.await?;
}
WstsNetMessage::DkgPrivateShares(dkg_private_shares) => {
tracing::info!(
"handling DkgPrivateShares from signer {}",
dkg_private_shares.signer_id
);
let public_keys = match self.wsts_state_machines.get(&msg.txid) {
Some(state_machine) => &state_machine.public_keys,
None => return Err(Error::MissingStateMachine),
};
let signer_public_key = match public_keys.signers.get(&dkg_private_shares.signer_id)
{
Some(key) => PublicKey::from(key),
None => return Err(Error::MissingPublicKey),
};

if signer_public_key != msg_public_key {
return Err(Error::InvalidSignature);
}
self.relay_message(msg.txid, &msg.inner, bitcoin_chain_tip)
.await?;
}
WstsNetMessage::DkgEndBegin(_) => {
tracing::info!("handling DkgEndBegin");
if !chain_tip_report.sender_is_coordinator {
Expand Down Expand Up @@ -627,7 +585,10 @@ where
}
}
}
WstsNetMessage::NonceResponse(_) | WstsNetMessage::SignatureShareResponse(_) => {
WstsNetMessage::DkgPublicShares(_)
| WstsNetMessage::DkgPrivateShares(_)
| WstsNetMessage::NonceResponse(_)
| WstsNetMessage::SignatureShareResponse(_) => {
tracing::debug!("ignoring message");
}
}
Expand Down

0 comments on commit 3f8be89

Please sign in to comment.