mirror of
https://github.com/serai-dex/serai.git
synced 2024-11-17 01:17:36 +00:00
Correct the coordinator tests
They assumed processor 0 had keys `i = 1`. Under the new validator-set code, the first key is the one with the highest amount, In case of tie, the key (or as of the last commit, a Blake hash) decides order. This commit kludges in a mapping from processor index to assigned key index, no longer assuming its value.
This commit is contained in:
parent
ab5af57dae
commit
9bf8c92325
3 changed files with 99 additions and 70 deletions
|
@ -29,6 +29,7 @@ use crate::{*, tests::*};
|
||||||
|
|
||||||
pub async fn batch(
|
pub async fn batch(
|
||||||
processors: &mut [Processor],
|
processors: &mut [Processor],
|
||||||
|
processor_is: &[u8],
|
||||||
substrate_key: &Zeroizing<<Ristretto as Ciphersuite>::F>,
|
substrate_key: &Zeroizing<<Ristretto as Ciphersuite>::F>,
|
||||||
batch: Batch,
|
batch: Batch,
|
||||||
) -> u64 {
|
) -> u64 {
|
||||||
|
@ -59,7 +60,7 @@ pub async fn batch(
|
||||||
.send_message(messages::coordinator::ProcessorMessage::BatchPreprocess {
|
.send_message(messages::coordinator::ProcessorMessage::BatchPreprocess {
|
||||||
id: id.clone(),
|
id: id.clone(),
|
||||||
block: batch.block,
|
block: batch.block,
|
||||||
preprocess: [u8::try_from(i).unwrap(); 64].to_vec(),
|
preprocess: [processor_is[i]; 64].to_vec(),
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +74,7 @@ pub async fn batch(
|
||||||
.send_message(messages::coordinator::ProcessorMessage::BatchPreprocess {
|
.send_message(messages::coordinator::ProcessorMessage::BatchPreprocess {
|
||||||
id: id.clone(),
|
id: id.clone(),
|
||||||
block: batch.block,
|
block: batch.block,
|
||||||
preprocess: [u8::try_from(excluded_signer).unwrap(); 64].to_vec(),
|
preprocess: [processor_is[excluded_signer]; 64].to_vec(),
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
|
@ -86,36 +87,32 @@ pub async fn batch(
|
||||||
) => {
|
) => {
|
||||||
assert_eq!(&id, &this_id);
|
assert_eq!(&id, &this_id);
|
||||||
assert_eq!(preprocesses.len(), THRESHOLD - 1);
|
assert_eq!(preprocesses.len(), THRESHOLD - 1);
|
||||||
assert!(!preprocesses
|
let known_signer_i = Participant::new(u16::from(processor_is[known_signer])).unwrap();
|
||||||
.contains_key(&Participant::new(u16::try_from(known_signer).unwrap() + 1).unwrap()));
|
assert!(!preprocesses.contains_key(&known_signer_i));
|
||||||
|
|
||||||
let mut participants =
|
let mut participants = preprocesses.keys().cloned().collect::<HashSet<_>>();
|
||||||
preprocesses.keys().map(|p| usize::from(u16::from(*p)) - 1).collect::<HashSet<_>>();
|
|
||||||
for (p, preprocess) in preprocesses {
|
for (p, preprocess) in preprocesses {
|
||||||
assert_eq!(preprocess, vec![u8::try_from(u16::from(p)).unwrap() - 1; 64]);
|
assert_eq!(preprocess, vec![u8::try_from(u16::from(p)).unwrap(); 64]);
|
||||||
}
|
}
|
||||||
participants.insert(known_signer);
|
participants.insert(known_signer_i);
|
||||||
participants
|
participants
|
||||||
}
|
}
|
||||||
_ => panic!("coordinator didn't send back BatchPreprocesses"),
|
_ => panic!("coordinator didn't send back BatchPreprocesses"),
|
||||||
};
|
};
|
||||||
|
|
||||||
for i in participants.clone() {
|
for i in participants.clone() {
|
||||||
if i == known_signer {
|
if u16::from(i) == u16::from(processor_is[known_signer]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let processor = &mut processors[i];
|
|
||||||
|
let processor =
|
||||||
|
&mut processors[processor_is.iter().position(|p_i| u16::from(*p_i) == u16::from(i)).unwrap()];
|
||||||
let mut preprocesses = participants
|
let mut preprocesses = participants
|
||||||
.clone()
|
.clone()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|i| {
|
.map(|i| (i, [u8::try_from(u16::from(i)).unwrap(); 64].to_vec()))
|
||||||
(
|
|
||||||
Participant::new(u16::try_from(i + 1).unwrap()).unwrap(),
|
|
||||||
[u8::try_from(i).unwrap(); 64].to_vec(),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.collect::<HashMap<_, _>>();
|
.collect::<HashMap<_, _>>();
|
||||||
preprocesses.remove(&Participant::new(u16::try_from(i + 1).unwrap()).unwrap());
|
preprocesses.remove(&i);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
processor.recv_message().await,
|
processor.recv_message().await,
|
||||||
|
@ -129,25 +126,25 @@ pub async fn batch(
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in participants.clone() {
|
for i in participants.clone() {
|
||||||
let processor = &mut processors[i];
|
let processor =
|
||||||
|
&mut processors[processor_is.iter().position(|p_i| u16::from(*p_i) == u16::from(i)).unwrap()];
|
||||||
processor
|
processor
|
||||||
.send_message(messages::coordinator::ProcessorMessage::BatchShare {
|
.send_message(messages::coordinator::ProcessorMessage::BatchShare {
|
||||||
id: id.clone(),
|
id: id.clone(),
|
||||||
share: [u8::try_from(i).unwrap(); 32],
|
share: [u8::try_from(u16::from(i)).unwrap(); 32],
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
wait_for_tributary().await;
|
wait_for_tributary().await;
|
||||||
for i in participants.clone() {
|
for i in participants.clone() {
|
||||||
let processor = &mut processors[i];
|
let processor =
|
||||||
|
&mut processors[processor_is.iter().position(|p_i| u16::from(*p_i) == u16::from(i)).unwrap()];
|
||||||
let mut shares = participants
|
let mut shares = participants
|
||||||
.clone()
|
.clone()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|i| {
|
.map(|i| (i, [u8::try_from(u16::from(i)).unwrap(); 32]))
|
||||||
(Participant::new(u16::try_from(i + 1).unwrap()).unwrap(), [u8::try_from(i).unwrap(); 32])
|
|
||||||
})
|
|
||||||
.collect::<HashMap<_, _>>();
|
.collect::<HashMap<_, _>>();
|
||||||
shares.remove(&Participant::new(u16::try_from(i + 1).unwrap()).unwrap());
|
shares.remove(&i);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
processor.recv_message().await,
|
processor.recv_message().await,
|
||||||
|
@ -271,9 +268,10 @@ async fn batch_test() {
|
||||||
}
|
}
|
||||||
let mut processors = new_processors;
|
let mut processors = new_processors;
|
||||||
|
|
||||||
let (substrate_key, _) = key_gen::<Secp256k1>(&mut processors).await;
|
let (processor_is, substrate_key, _) = key_gen::<Secp256k1>(&mut processors).await;
|
||||||
batch(
|
batch(
|
||||||
&mut processors,
|
&mut processors,
|
||||||
|
&processor_is,
|
||||||
&substrate_key,
|
&substrate_key,
|
||||||
Batch {
|
Batch {
|
||||||
network: NetworkId::Bitcoin,
|
network: NetworkId::Bitcoin,
|
||||||
|
|
|
@ -11,7 +11,7 @@ use ciphersuite::{
|
||||||
group::{ff::Field, GroupEncoding},
|
group::{ff::Field, GroupEncoding},
|
||||||
Ciphersuite, Ristretto, Secp256k1,
|
Ciphersuite, Ristretto, Secp256k1,
|
||||||
};
|
};
|
||||||
use dkg::{Participant, ThresholdParams};
|
use dkg::ThresholdParams;
|
||||||
|
|
||||||
use serai_client::{
|
use serai_client::{
|
||||||
primitives::NetworkId,
|
primitives::NetworkId,
|
||||||
|
@ -24,21 +24,32 @@ use crate::{*, tests::*};
|
||||||
|
|
||||||
pub async fn key_gen<C: Ciphersuite>(
|
pub async fn key_gen<C: Ciphersuite>(
|
||||||
processors: &mut [Processor],
|
processors: &mut [Processor],
|
||||||
) -> (Zeroizing<<Ristretto as Ciphersuite>::F>, Zeroizing<C::F>) {
|
) -> (Vec<u8>, Zeroizing<<Ristretto as Ciphersuite>::F>, Zeroizing<C::F>) {
|
||||||
let participant_from_i = |i: usize| Participant::new(u16::try_from(i + 1).unwrap()).unwrap();
|
let mut participant_is = vec![];
|
||||||
|
|
||||||
let set = ValidatorSet { session: Session(0), network: NetworkId::Bitcoin };
|
let set = ValidatorSet { session: Session(0), network: NetworkId::Bitcoin };
|
||||||
let id = KeyGenId { set, attempt: 0 };
|
let id = KeyGenId { set, attempt: 0 };
|
||||||
|
|
||||||
for (i, processor) in processors.iter_mut().enumerate() {
|
for (i, processor) in processors.iter_mut().enumerate() {
|
||||||
|
let msg = processor.recv_message().await;
|
||||||
|
match &msg {
|
||||||
|
CoordinatorMessage::KeyGen(messages::key_gen::CoordinatorMessage::GenerateKey {
|
||||||
|
params,
|
||||||
|
..
|
||||||
|
}) => {
|
||||||
|
participant_is.push(params.i());
|
||||||
|
}
|
||||||
|
_ => panic!("unexpected message: {msg:?}"),
|
||||||
|
}
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
processor.recv_message().await,
|
msg,
|
||||||
CoordinatorMessage::KeyGen(messages::key_gen::CoordinatorMessage::GenerateKey {
|
CoordinatorMessage::KeyGen(messages::key_gen::CoordinatorMessage::GenerateKey {
|
||||||
id,
|
id,
|
||||||
params: ThresholdParams::new(
|
params: ThresholdParams::new(
|
||||||
u16::try_from(((COORDINATORS * 2) / 3) + 1).unwrap(),
|
u16::try_from(((COORDINATORS * 2) / 3) + 1).unwrap(),
|
||||||
u16::try_from(COORDINATORS).unwrap(),
|
u16::try_from(COORDINATORS).unwrap(),
|
||||||
participant_from_i(i),
|
participant_is[i],
|
||||||
)
|
)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
})
|
})
|
||||||
|
@ -47,7 +58,7 @@ pub async fn key_gen<C: Ciphersuite>(
|
||||||
processor
|
processor
|
||||||
.send_message(messages::key_gen::ProcessorMessage::Commitments {
|
.send_message(messages::key_gen::ProcessorMessage::Commitments {
|
||||||
id,
|
id,
|
||||||
commitments: vec![u8::try_from(i).unwrap()],
|
commitments: vec![u8::try_from(u16::from(participant_is[i])).unwrap()],
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
@ -55,9 +66,14 @@ pub async fn key_gen<C: Ciphersuite>(
|
||||||
wait_for_tributary().await;
|
wait_for_tributary().await;
|
||||||
for (i, processor) in processors.iter_mut().enumerate() {
|
for (i, processor) in processors.iter_mut().enumerate() {
|
||||||
let mut commitments = (0 .. u8::try_from(COORDINATORS).unwrap())
|
let mut commitments = (0 .. u8::try_from(COORDINATORS).unwrap())
|
||||||
.map(|l| (participant_from_i(l.into()), vec![l]))
|
.map(|l| {
|
||||||
|
(
|
||||||
|
participant_is[usize::from(l)],
|
||||||
|
vec![u8::try_from(u16::from(participant_is[usize::from(l)])).unwrap()],
|
||||||
|
)
|
||||||
|
})
|
||||||
.collect::<HashMap<_, _>>();
|
.collect::<HashMap<_, _>>();
|
||||||
commitments.remove(&participant_from_i(i));
|
commitments.remove(&participant_is[i]);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
processor.recv_message().await,
|
processor.recv_message().await,
|
||||||
CoordinatorMessage::KeyGen(messages::key_gen::CoordinatorMessage::Commitments {
|
CoordinatorMessage::KeyGen(messages::key_gen::CoordinatorMessage::Commitments {
|
||||||
|
@ -66,13 +82,20 @@ pub async fn key_gen<C: Ciphersuite>(
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
// from (0 .. n), to (1 ..= n)
|
// Recipient it's for -> (Sender i, Recipient i)
|
||||||
let mut shares = (0 .. u8::try_from(COORDINATORS).unwrap())
|
let mut shares = (0 .. u8::try_from(COORDINATORS).unwrap())
|
||||||
.map(|l| (participant_from_i(l.into()), vec![u8::try_from(i).unwrap(), l + 1]))
|
.map(|l| {
|
||||||
|
(
|
||||||
|
participant_is[usize::from(l)],
|
||||||
|
vec![
|
||||||
|
u8::try_from(u16::try_from(participant_is[i]).unwrap()).unwrap(),
|
||||||
|
u8::try_from(u16::from(participant_is[usize::from(l)])).unwrap(),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
})
|
||||||
.collect::<HashMap<_, _>>();
|
.collect::<HashMap<_, _>>();
|
||||||
|
|
||||||
let i = participant_from_i(i);
|
shares.remove(&participant_is[i]);
|
||||||
shares.remove(&i);
|
|
||||||
processor.send_message(messages::key_gen::ProcessorMessage::Shares { id, shares }).await;
|
processor.send_message(messages::key_gen::ProcessorMessage::Shares { id, shares }).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,14 +110,22 @@ pub async fn key_gen<C: Ciphersuite>(
|
||||||
|
|
||||||
wait_for_tributary().await;
|
wait_for_tributary().await;
|
||||||
for (i, processor) in processors.iter_mut().enumerate() {
|
for (i, processor) in processors.iter_mut().enumerate() {
|
||||||
let i = participant_from_i(i);
|
let i = participant_is[i];
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
processor.recv_message().await,
|
processor.recv_message().await,
|
||||||
CoordinatorMessage::KeyGen(messages::key_gen::CoordinatorMessage::Shares {
|
CoordinatorMessage::KeyGen(messages::key_gen::CoordinatorMessage::Shares {
|
||||||
id,
|
id,
|
||||||
shares: {
|
shares: {
|
||||||
let mut shares = (0 .. u8::try_from(COORDINATORS).unwrap())
|
let mut shares = (0 .. u8::try_from(COORDINATORS).unwrap())
|
||||||
.map(|l| (participant_from_i(l.into()), vec![l, u8::try_from(u16::from(i)).unwrap()]))
|
.map(|l| {
|
||||||
|
(
|
||||||
|
participant_is[usize::from(l)],
|
||||||
|
vec![
|
||||||
|
u8::try_from(u16::from(participant_is[usize::from(l)])).unwrap(),
|
||||||
|
u8::try_from(u16::from(i)).unwrap(),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
})
|
||||||
.collect::<HashMap<_, _>>();
|
.collect::<HashMap<_, _>>();
|
||||||
shares.remove(&i);
|
shares.remove(&i);
|
||||||
shares
|
shares
|
||||||
|
@ -172,7 +203,11 @@ pub async fn key_gen<C: Ciphersuite>(
|
||||||
(Public(substrate_key), network_key.try_into().unwrap())
|
(Public(substrate_key), network_key.try_into().unwrap())
|
||||||
);
|
);
|
||||||
|
|
||||||
(substrate_priv_key, network_priv_key)
|
(
|
||||||
|
participant_is.into_iter().map(|i| u8::try_from(u16::from(i)).unwrap()).collect(),
|
||||||
|
substrate_priv_key,
|
||||||
|
network_priv_key,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|
|
@ -29,6 +29,7 @@ use crate::{*, tests::*};
|
||||||
|
|
||||||
pub async fn sign<C: Ciphersuite>(
|
pub async fn sign<C: Ciphersuite>(
|
||||||
processors: &mut [Processor],
|
processors: &mut [Processor],
|
||||||
|
processor_is: &[u8],
|
||||||
network_key: &Zeroizing<C::F>,
|
network_key: &Zeroizing<C::F>,
|
||||||
plan_id: [u8; 32],
|
plan_id: [u8; 32],
|
||||||
) {
|
) {
|
||||||
|
@ -50,7 +51,7 @@ pub async fn sign<C: Ciphersuite>(
|
||||||
processor
|
processor
|
||||||
.send_message(messages::sign::ProcessorMessage::Preprocess {
|
.send_message(messages::sign::ProcessorMessage::Preprocess {
|
||||||
id: id.clone(),
|
id: id.clone(),
|
||||||
preprocess: [u8::try_from(i).unwrap(); 64].to_vec(),
|
preprocess: [processor_is[i]; 64].to_vec(),
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +64,7 @@ pub async fn sign<C: Ciphersuite>(
|
||||||
processors[excluded_signer]
|
processors[excluded_signer]
|
||||||
.send_message(messages::sign::ProcessorMessage::Preprocess {
|
.send_message(messages::sign::ProcessorMessage::Preprocess {
|
||||||
id: id.clone(),
|
id: id.clone(),
|
||||||
preprocess: [u8::try_from(excluded_signer).unwrap(); 64].to_vec(),
|
preprocess: [processor_is[excluded_signer]; 64].to_vec(),
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
|
@ -76,37 +77,32 @@ pub async fn sign<C: Ciphersuite>(
|
||||||
}) => {
|
}) => {
|
||||||
assert_eq!(&id, &this_id);
|
assert_eq!(&id, &this_id);
|
||||||
assert_eq!(preprocesses.len(), THRESHOLD - 1);
|
assert_eq!(preprocesses.len(), THRESHOLD - 1);
|
||||||
assert!(!preprocesses
|
let known_signer_i = Participant::new(u16::from(processor_is[known_signer])).unwrap();
|
||||||
.contains_key(&Participant::new(u16::try_from(known_signer).unwrap() + 1).unwrap()));
|
assert!(!preprocesses.contains_key(&known_signer_i));
|
||||||
|
|
||||||
let mut participants =
|
let mut participants = preprocesses.keys().cloned().collect::<HashSet<_>>();
|
||||||
preprocesses.keys().map(|p| usize::from(u16::from(*p)) - 1).collect::<HashSet<_>>();
|
|
||||||
for (p, preprocess) in preprocesses {
|
for (p, preprocess) in preprocesses {
|
||||||
assert_eq!(preprocess, vec![u8::try_from(u16::from(p)).unwrap() - 1; 64]);
|
assert_eq!(preprocess, vec![u8::try_from(u16::from(p)).unwrap(); 64]);
|
||||||
}
|
}
|
||||||
participants.insert(known_signer);
|
participants.insert(known_signer_i);
|
||||||
participants
|
participants
|
||||||
}
|
}
|
||||||
_ => panic!("coordinator didn't send back Preprocesses"),
|
_ => panic!("coordinator didn't send back Preprocesses"),
|
||||||
};
|
};
|
||||||
|
|
||||||
for i in participants.clone() {
|
for i in participants.clone() {
|
||||||
if i == known_signer {
|
if u16::from(i) == u16::from(processor_is[known_signer]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
let processor = &mut processors[i];
|
let processor =
|
||||||
|
&mut processors[processor_is.iter().position(|p_i| u16::from(*p_i) == u16::from(i)).unwrap()];
|
||||||
let mut preprocesses = participants
|
let mut preprocesses = participants
|
||||||
.clone()
|
.clone()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|i| {
|
.map(|i| (i, [u8::try_from(u16::from(i)).unwrap(); 64].to_vec()))
|
||||||
(
|
|
||||||
Participant::new(u16::try_from(i + 1).unwrap()).unwrap(),
|
|
||||||
[u8::try_from(i).unwrap(); 64].to_vec(),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.collect::<HashMap<_, _>>();
|
.collect::<HashMap<_, _>>();
|
||||||
preprocesses.remove(&Participant::new(u16::try_from(i + 1).unwrap()).unwrap());
|
preprocesses.remove(&i);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
processor.recv_message().await,
|
processor.recv_message().await,
|
||||||
|
@ -118,28 +114,25 @@ pub async fn sign<C: Ciphersuite>(
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in participants.clone() {
|
for i in participants.clone() {
|
||||||
let processor = &mut processors[i];
|
let processor =
|
||||||
|
&mut processors[processor_is.iter().position(|p_i| u16::from(*p_i) == u16::from(i)).unwrap()];
|
||||||
processor
|
processor
|
||||||
.send_message(messages::sign::ProcessorMessage::Share {
|
.send_message(messages::sign::ProcessorMessage::Share {
|
||||||
id: id.clone(),
|
id: id.clone(),
|
||||||
share: vec![u8::try_from(i).unwrap(); 32],
|
share: vec![u8::try_from(u16::from(i)).unwrap(); 32],
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
wait_for_tributary().await;
|
wait_for_tributary().await;
|
||||||
for i in participants.clone() {
|
for i in participants.clone() {
|
||||||
let processor = &mut processors[i];
|
let processor =
|
||||||
|
&mut processors[processor_is.iter().position(|p_i| u16::from(*p_i) == u16::from(i)).unwrap()];
|
||||||
let mut shares = participants
|
let mut shares = participants
|
||||||
.clone()
|
.clone()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|i| {
|
.map(|i| (i, vec![u8::try_from(u16::from(i)).unwrap(); 32]))
|
||||||
(
|
|
||||||
Participant::new(u16::try_from(i + 1).unwrap()).unwrap(),
|
|
||||||
vec![u8::try_from(i).unwrap(); 32],
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.collect::<HashMap<_, _>>();
|
.collect::<HashMap<_, _>>();
|
||||||
shares.remove(&Participant::new(u16::try_from(i + 1).unwrap()).unwrap());
|
shares.remove(&i);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
processor.recv_message().await,
|
processor.recv_message().await,
|
||||||
|
@ -152,7 +145,8 @@ pub async fn sign<C: Ciphersuite>(
|
||||||
|
|
||||||
// Send Completed
|
// Send Completed
|
||||||
for i in participants.clone() {
|
for i in participants.clone() {
|
||||||
let processor = &mut processors[i];
|
let processor =
|
||||||
|
&mut processors[processor_is.iter().position(|p_i| u16::from(*p_i) == u16::from(i)).unwrap()];
|
||||||
processor
|
processor
|
||||||
.send_message(messages::sign::ProcessorMessage::Completed {
|
.send_message(messages::sign::ProcessorMessage::Completed {
|
||||||
key: id.key.clone(),
|
key: id.key.clone(),
|
||||||
|
@ -199,7 +193,8 @@ async fn sign_test() {
|
||||||
}
|
}
|
||||||
let mut processors = new_processors;
|
let mut processors = new_processors;
|
||||||
|
|
||||||
let (substrate_key, network_key) = key_gen::<Secp256k1>(&mut processors).await;
|
let (participant_is, substrate_key, network_key) =
|
||||||
|
key_gen::<Secp256k1>(&mut processors).await;
|
||||||
|
|
||||||
// 'Send' external coins into Serai
|
// 'Send' external coins into Serai
|
||||||
let serai = processors[0].serai().await;
|
let serai = processors[0].serai().await;
|
||||||
|
@ -234,6 +229,7 @@ async fn sign_test() {
|
||||||
let coin_block = BlockHash([0x33; 32]);
|
let coin_block = BlockHash([0x33; 32]);
|
||||||
let block_included_in = batch(
|
let block_included_in = batch(
|
||||||
&mut processors,
|
&mut processors,
|
||||||
|
&participant_is,
|
||||||
&substrate_key,
|
&substrate_key,
|
||||||
Batch {
|
Batch {
|
||||||
network: NetworkId::Bitcoin,
|
network: NetworkId::Bitcoin,
|
||||||
|
@ -366,7 +362,7 @@ async fn sign_test() {
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
sign::<Secp256k1>(&mut processors, &network_key, plan_id).await;
|
sign::<Secp256k1>(&mut processors, &participant_is, &network_key, plan_id).await;
|
||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue