Correct the coordinator tests

They weren't updated with the past couple of commits.
This commit is contained in:
Luke Parker 2023-09-29 04:35:00 -04:00
parent bd5491dfd5
commit aa59f53ead
No known key found for this signature in database
4 changed files with 21 additions and 4 deletions

2
Cargo.lock generated
View file

@ -8191,10 +8191,12 @@ dependencies = [
name = "serai-coordinator-tests"
version = "0.1.0"
dependencies = [
"blake2",
"ciphersuite",
"dkg",
"dockertest",
"hex",
"parity-scale-codec",
"rand_core 0.6.4",
"schnorrkel",
"serai-client",

View file

@ -19,12 +19,15 @@ hex = "0.4"
zeroize = { version = "1", default-features = false }
rand_core = { version = "0.6", default-features = false }
blake2 = "0.10"
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["ristretto", "secp256k1"] }
schnorrkel = "0.11"
dkg = { path = "../../crypto/dkg", default-features = false, features = ["tests"] }
messages = { package = "serai-processor-messages", path = "../../processor/messages" }
scale = { package = "parity-scale-codec", version = "3" }
serai-client = { path = "../../substrate/client", features = ["serai"] }
serai-message-queue = { path = "../../message-queue" }

View file

@ -7,10 +7,15 @@ use std::{
use zeroize::Zeroizing;
use rand_core::{RngCore, OsRng};
use blake2::{
digest::{consts::U32, Digest},
Blake2b,
};
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto, Secp256k1};
use dkg::Participant;
use scale::Encode;
use serai_client::{
primitives::{NetworkId, BlockHash, Signature},
in_instructions::{
@ -35,6 +40,12 @@ pub async fn batch(
attempt: 0,
};
for processor in processors.iter_mut() {
processor
.send_message(messages::substrate::ProcessorMessage::Batch { batch: batch.clone() })
.await;
}
// Select a random participant to exclude, so we know for sure who *is* participating
assert_eq!(COORDINATORS - THRESHOLD, 1);
let excluded_signer =
@ -168,7 +179,7 @@ pub async fn batch(
for processor in processors.iter_mut() {
processor
.send_message(messages::substrate::ProcessorMessage::Update { batch: batch.clone() })
.send_message(messages::substrate::ProcessorMessage::SignedBatch { batch: batch.clone() })
.await;
}
@ -194,7 +205,8 @@ pub async fn batch(
InInstructionsEvent::Batch {
network: batch.batch.network,
id: batch.batch.id,
block: batch.batch.block
block: batch.batch.block,
instructions_hash: Blake2b::<U32>::digest(batch.batch.instructions.encode()).into(),
}
);
break 'outer;

View file

@ -256,7 +256,7 @@ fn batch_test() {
},
};
// Make sure the proceessors picked it up by checking they're trying to sign a batch for it
// Make sure the processors picked it up by checking they're trying to sign a batch for it
let (mut id, mut preprocesses) =
recv_batch_preprocesses(&mut coordinators, &key_pair.0 .0, &expected_batch, 0).await;
// Trigger a random amount of re-attempts