diff --git a/Cargo.lock b/Cargo.lock index 49caf7993..76a072dff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -7987,8 +7987,9 @@ dependencies = [ [[package]] name = "wsts" -version = "10.0.0" -source = "git+https://github.com/Trust-Machines/wsts.git?rev=53ae23f5f35def420877ccc8c0fe3662e64e38a1#53ae23f5f35def420877ccc8c0fe3662e64e38a1" +version = "12.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5768ec22f0c646d9992acdd5374cf43f6d0d5aa94bc8016ad55d685f49b72cac" dependencies = [ "aes-gcm", "bs58 0.5.1", diff --git a/Cargo.toml b/Cargo.toml index 3303c3346..055befd59 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,7 +75,7 @@ tracing = { version = "0.1", default-features = false } tracing-attributes = "0.1" url = "2.5" warp_lambda = "0.1.4" -wsts = "9.2.0" +wsts = "12.0.0" hex = "0.4.3" libp2p = { version = "0.54.1", default-features = false, features = [ "macros", "kad", "noise", "ping", "tcp", diff --git a/signer/Cargo.toml b/signer/Cargo.toml index 61dc4dfb9..ad10ec0c3 100644 --- a/signer/Cargo.toml +++ b/signer/Cargo.toml @@ -51,8 +51,7 @@ tracing.workspace = true tracing-attributes.workspace = true tracing-subscriber = { workspace = true } url.workspace = true -# wsts.workspace = true -wsts = { git = "https://github.com/Trust-Machines/wsts.git", rev = "53ae23f5f35def420877ccc8c0fe3662e64e38a1" } +wsts.workspace = true hex.workspace = true cfg-if = "1.0" include_dir = "0.7.4" diff --git a/signer/src/testing/wsts.rs b/signer/src/testing/wsts.rs index 2055ebe71..d2c0e552b 100644 --- a/signer/src/testing/wsts.rs +++ b/signer/src/testing/wsts.rs @@ -7,6 +7,7 @@ use std::time::Duration; use clarity::util::secp256k1::Secp256k1PublicKey; use clarity::vm::types::PrincipalData; use fake::Fake; +use rand::rngs::OsRng; use stacks_common::address::AddressHashMode; use stacks_common::address::C32_ADDRESS_VERSION_TESTNET_MULTISIG; use stacks_common::types::chainstate::StacksAddress; @@ -249,6 +250,7 @@ impl Signer { /// Participate in a DKG round and return the result pub async fn run_until_dkg_end(mut self) -> Self { let future = async move { + let mut rng = OsRng; loop { let msg = self.network.receive().await.expect("network error"); let bitcoin_chain_tip = msg.bitcoin_chain_tip; @@ -264,12 +266,12 @@ impl Signer { let outbound_packets = self .wsts_signer - .process_inbound_messages(&[packet]) + .process_inbound_messages(&[packet], &mut rng) .expect("message processing failed"); for packet in outbound_packets { self.wsts_signer - .process_inbound_messages(&[packet.clone()]) + .process_inbound_messages(&[packet.clone()], &mut rng) .expect("message processing failed"); self.send_packet(bitcoin_chain_tip, wsts_msg.txid, packet.clone()) @@ -289,6 +291,7 @@ impl Signer { /// Participate in a signing round and return the result pub async fn run_until_signature_share_response(mut self) -> Self { let future = async move { + let mut rng = OsRng; loop { let msg = self.network.receive().await.expect("network error"); let bitcoin_chain_tip = msg.bitcoin_chain_tip; @@ -304,12 +307,12 @@ impl Signer { let outbound_packets = self .wsts_signer - .process_inbound_messages(&[packet]) + .process_inbound_messages(&[packet], &mut rng) .expect("message processing failed"); for packet in outbound_packets { self.wsts_signer - .process_inbound_messages(&[packet.clone()]) + .process_inbound_messages(&[packet.clone()], &mut rng) .expect("message processing failed"); self.send_packet(bitcoin_chain_tip, wsts_msg.txid, packet.clone()) diff --git a/signer/src/transaction_signer.rs b/signer/src/transaction_signer.rs index f3cdf5076..f39131f00 100644 --- a/signer/src/transaction_signer.rs +++ b/signer/src/transaction_signer.rs @@ -45,6 +45,7 @@ use bitcoin::hashes::Hash as _; use bitcoin::TapSighash; use futures::StreamExt; use lru::LruCache; +use rand::rngs::OsRng; use wsts::net::DkgEnd; use wsts::net::DkgStatus; use wsts::net::Message as WstsNetMessage; @@ -744,17 +745,18 @@ where msg: &WstsNetMessage, bitcoin_chain_tip: &model::BitcoinBlockHash, ) -> Result<(), Error> { + let mut rng = OsRng; let Some(state_machine) = self.wsts_state_machines.get_mut(&id) else { tracing::warn!("missing signing round"); return Err(Error::MissingStateMachine); }; - let outbound_messages = state_machine.process(msg).map_err(Error::Wsts)?; + let outbound_messages = state_machine.process(msg, &mut rng).map_err(Error::Wsts)?; for outbound_message in outbound_messages.iter() { // The WSTS state machine assume we read our own messages state_machine - .process(outbound_message) + .process(outbound_message, &mut rng) .map_err(Error::Wsts)?; } diff --git a/signer/src/wsts_state_machine.rs b/signer/src/wsts_state_machine.rs index 2f8d29ea0..f346c0fba 100644 --- a/signer/src/wsts_state_machine.rs +++ b/signer/src/wsts_state_machine.rs @@ -17,6 +17,7 @@ use crate::storage::model::SigHash; use bitcoin::hashes::Hash as _; use hashbrown::HashMap; use hashbrown::HashSet; +use rand::rngs::OsRng; use wsts::common::PolyCommitment; use wsts::state_machine::coordinator::Coordinator as _; use wsts::state_machine::coordinator::State as WstsState; @@ -65,6 +66,7 @@ impl SignerStateMachine { threshold: u32, signer_private_key: PrivateKey, ) -> Result { + let mut rng = OsRng; let signer_pub_key = PublicKey::from_private_key(&signer_private_key); let signers: hashbrown::HashMap = signers .into_iter() @@ -121,6 +123,7 @@ impl SignerStateMachine { key_ids, signer_private_key.into(), public_keys, + &mut rng, ) .map_err(Error::Wsts)?;