update stacks-signer and tests to use generic wsts state machines

This commit is contained in:
Joey Yandle
2023-09-29 15:48:02 -04:00
parent 57c08bd238
commit 851217d577
4 changed files with 16 additions and 9 deletions

2
Cargo.lock generated
View File

@@ -4416,7 +4416,7 @@ dependencies = [
[[package]]
name = "wsts"
version = "4.0.0"
source = "git+https://github.com/Trust-Machines/wsts?branch=add-network-types#d7829b67907bf914a76a7c3220aa1298e95390b1"
source = "git+https://github.com/Trust-Machines/wsts?branch=add-network-types#ee9076af85a1a97523db8e99e3b04291230ef218"
dependencies = [
"aes-gcm 0.10.2",
"bs58 0.5.0",

View File

@@ -56,7 +56,10 @@ use std::{
sync::mpsc::{channel, Receiver, Sender},
time::Duration,
};
use wsts::state_machine::{coordinator::Coordinator as FrostCoordinator, OperationResult};
use wsts::{
state_machine::{coordinator::Coordinator as FrostCoordinator, OperationResult},
v1,
};
struct SpawnedSigner {
running_signer: RunningSigner<StackerDBEventReceiver, Vec<OperationResult>>,
@@ -90,11 +93,11 @@ fn spawn_running_signer(path: &PathBuf) -> SpawnedSigner {
let (cmd_send, cmd_recv) = channel();
let (res_send, res_recv) = channel();
let ev = StackerDBEventReceiver::new(vec![config.stackerdb_contract_id.clone()]);
let runloop: RunLoop<FrostCoordinator> = RunLoop::from(&config);
let runloop: RunLoop<FrostCoordinator<v1::Aggregator>> = RunLoop::from(&config);
let mut signer: Signer<
RunLoopCommand,
Vec<OperationResult>,
RunLoop<FrostCoordinator>,
RunLoop<FrostCoordinator<v1::Aggregator>>,
StackerDBEventReceiver,
> = Signer::new(runloop, ev, cmd_recv, res_send);
let endpoint = config.node_host;

View File

@@ -12,6 +12,7 @@ use wsts::{
signer::SigningRound,
OperationResult, PublicKeys,
},
v1,
};
/// Which operation to perform
@@ -50,7 +51,7 @@ pub struct RunLoop<C> {
/// The signing round used to sign messages
// TODO: update this to use frost_signer directly instead of the frost signing round
// See: https://github.com/stacks-network/stacks-blockchain/issues/3913
pub signing_round: SigningRound,
pub signing_round: SigningRound<v1::Signer>,
/// The stacks client
pub stacks_client: StacksClient,
/// Received Commands that need to be processed
@@ -175,7 +176,7 @@ impl<C: Coordinatable> RunLoop<C> {
}
}
impl From<&Config> for RunLoop<FrostCoordinator> {
impl From<&Config> for RunLoop<FrostCoordinator<v1::Aggregator>> {
/// Creates new runloop from a config
fn from(config: &Config) -> Self {
// TODO: this should be a config option

View File

@@ -24,7 +24,10 @@ use stacks_signer::{
runloop::RunLoopCommand,
utils::{build_signer_config_tomls, build_stackerdb_contract},
};
use wsts::state_machine::{coordinator::Coordinator as FrostCoordinator, OperationResult};
use wsts::{
state_machine::{coordinator::Coordinator as FrostCoordinator, OperationResult},
v1,
};
// Helper struct for holding the btc and stx neon nodes
#[allow(dead_code)]
@@ -42,12 +45,12 @@ fn spawn_signer(
) -> RunningSigner<StackerDBEventReceiver, Vec<OperationResult>> {
let config = stacks_signer::config::Config::load_from_str(data).unwrap();
let ev = StackerDBEventReceiver::new(vec![config.stackerdb_contract_id.clone()]);
let runloop: stacks_signer::runloop::RunLoop<FrostCoordinator> =
let runloop: stacks_signer::runloop::RunLoop<FrostCoordinator<v1::Aggregator>> =
stacks_signer::runloop::RunLoop::from(&config);
let mut signer: Signer<
RunLoopCommand,
Vec<OperationResult>,
stacks_signer::runloop::RunLoop<FrostCoordinator>,
stacks_signer::runloop::RunLoop<FrostCoordinator<v1::Aggregator>>,
StackerDBEventReceiver,
> = Signer::new(runloop, ev, receiver, sender);
let endpoint = config.endpoint;