Update the processor's tests re: Batch SignId key

key used to be empty. As part of implementing support for multisig rotation
into the coordinator, it was easiest to set the key to the substrate key. While
the coordinator and full stack tests were updated, the processor tests weren't.
This does that.
This commit is contained in:
Luke Parker 2023-09-27 23:32:29 -04:00
parent 7e27315207
commit 4d1212ec65
No known key found for this signature in database
2 changed files with 7 additions and 4 deletions

View file

@ -18,6 +18,7 @@ use crate::{*, tests::*};
pub(crate) async fn recv_batch_preprocesses( pub(crate) async fn recv_batch_preprocesses(
coordinators: &mut [Coordinator], coordinators: &mut [Coordinator],
substrate_key: &[u8; 32],
attempt: u32, attempt: u32,
) -> (SignId, HashMap<Participant, Vec<u8>>) { ) -> (SignId, HashMap<Participant, Vec<u8>>) {
let mut id = None; let mut id = None;
@ -36,7 +37,7 @@ pub(crate) async fn recv_batch_preprocesses(
}, },
) => { ) => {
if id.is_none() { if id.is_none() {
assert!(this_id.key.is_empty()); assert_eq!(&this_id.key, substrate_key);
assert_eq!(this_id.attempt, attempt); assert_eq!(this_id.attempt, attempt);
id = Some(this_id.clone()); id = Some(this_id.clone());
block = Some(this_block); block = Some(this_block);
@ -231,7 +232,8 @@ fn batch_test() {
tokio::time::sleep(Duration::from_secs(10)).await; tokio::time::sleep(Duration::from_secs(10)).await;
// Make sure the proceessors picked it up by checking they're trying to sign a batch for it // Make sure the proceessors picked it up by checking they're trying to sign a batch for it
let (mut id, mut preprocesses) = recv_batch_preprocesses(&mut coordinators, 0).await; let (mut id, mut preprocesses) =
recv_batch_preprocesses(&mut coordinators, &key_pair.0 .0, 0).await;
// Trigger a random amount of re-attempts // Trigger a random amount of re-attempts
for attempt in 1 ..= u32::try_from(OsRng.next_u64() % 4).unwrap() { for attempt in 1 ..= u32::try_from(OsRng.next_u64() % 4).unwrap() {
// TODO: Double check how the processor handles this ID field // TODO: Double check how the processor handles this ID field
@ -244,7 +246,8 @@ fn batch_test() {
}) })
.await; .await;
} }
(id, preprocesses) = recv_batch_preprocesses(&mut coordinators, attempt).await; (id, preprocesses) =
recv_batch_preprocesses(&mut coordinators, &key_pair.0 .0, attempt).await;
} }
// Continue with signing the batch // Continue with signing the batch

View file

@ -187,7 +187,7 @@ fn send_test() {
tokio::time::sleep(Duration::from_secs(10)).await; tokio::time::sleep(Duration::from_secs(10)).await;
// Make sure the proceessors picked it up by checking they're trying to sign a batch for it // Make sure the proceessors picked it up by checking they're trying to sign a batch for it
let (id, preprocesses) = recv_batch_preprocesses(&mut coordinators, 0).await; let (id, preprocesses) = recv_batch_preprocesses(&mut coordinators, &key_pair.0 .0, 0).await;
// Continue with signing the batch // Continue with signing the batch
let batch = sign_batch(&mut coordinators, key_pair.0 .0, id, preprocesses).await; let batch = sign_batch(&mut coordinators, key_pair.0 .0, id, preprocesses).await;