fix off-by-one with signer_id and key_ids

This commit is contained in:
Joey Yandle
2023-09-10 06:37:51 -04:00
parent 659a6c384e
commit e18b197a8a
2 changed files with 6 additions and 4 deletions

View File

@@ -40,7 +40,7 @@ impl Coordinator {
dkg_public_shares: Default::default(),
aggregate_public_key: Point::default(),
message_private_key,
ids_to_await: (1..=total_signers).collect(),
ids_to_await: (0..total_signers).collect(),
state: State::Idle,
}
}
@@ -166,7 +166,7 @@ impl Coordinator {
warn!("DKG Round #{} Failed: Aggregate public key does not have even y coord, re-running dkg.", self.current_dkg_id);
self.move_to(State::DkgPublicDistribute)?;
}
self.ids_to_await = (1..=self.total_signers).collect();
self.ids_to_await = (0..self.total_signers).collect();
}
Ok(())
}
@@ -185,7 +185,7 @@ impl Coordinator {
}
if self.ids_to_await.is_empty() {
self.ids_to_await = (1..=self.total_signers).collect();
self.ids_to_await = (0..self.total_signers).collect();
self.move_to(State::Idle)?;
}
Ok(())

View File

@@ -188,7 +188,9 @@ impl RunLoop<FrostCoordinator> {
.signer_key_ids
.get(&config.signer_id)
.unwrap()
.clone();
.iter()
.map(|i| i - 1) // SigningRound::new (unlike SigningRound::from) doesn't do this
.collect::<Vec<u32>>();
RunLoop {
event_timeout: config.event_timeout,
coordinator: FrostCoordinator::new(total_signers, config.message_private_key),