mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 12:49:23 +00:00
Resolve clippy errors from recent merges
This commit is contained in:
@@ -19,7 +19,7 @@ use sp_runtime::{
|
||||
};
|
||||
|
||||
use serai_primitives::*;
|
||||
use validator_sets::{primitives::MAX_KEY_SHARES_PER_SET, MembershipProof};
|
||||
use validator_sets::{primitives::MAX_KEY_SHARES_PER_SET_U32, MembershipProof};
|
||||
|
||||
pub use crate as validator_sets;
|
||||
pub use coins_pallet as coins;
|
||||
@@ -30,7 +30,7 @@ pub use pallet_timestamp as timestamp;
|
||||
|
||||
type Block = frame_system::mocking::MockBlock<Test>;
|
||||
// Maximum number of authorities per session.
|
||||
pub type MaxAuthorities = ConstU32<{ MAX_KEY_SHARES_PER_SET }>;
|
||||
pub type MaxAuthorities = ConstU32<{ MAX_KEY_SHARES_PER_SET_U32 }>;
|
||||
|
||||
pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4);
|
||||
pub const BABE_GENESIS_EPOCH_CONFIG: sp_consensus_babe::BabeEpochConfiguration =
|
||||
@@ -176,9 +176,16 @@ pub(crate) fn new_test_ext() -> sp_io::TestExternalities {
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
|
||||
#[expect(unused_variables, unreachable_code, clippy::diverging_sub_expression)]
|
||||
validator_sets::GenesisConfig::<Test> {
|
||||
networks,
|
||||
participants: genesis_participants().into_iter().map(|p| p.public()).collect(),
|
||||
participants: genesis_participants()
|
||||
.into_iter()
|
||||
.map(|p| {
|
||||
let keys: crate::AllEmbeddedEllipticCurveKeysAtGenesis = todo!("TODO");
|
||||
(p.public(), keys)
|
||||
})
|
||||
.collect(),
|
||||
}
|
||||
.assimilate_storage(&mut t)
|
||||
.unwrap();
|
||||
|
||||
@@ -20,7 +20,7 @@ use sp_core::{
|
||||
sr25519::{Public, Pair, Signature},
|
||||
Pair as PairTrait,
|
||||
};
|
||||
use sp_runtime::{traits::ValidateUnsigned, BoundedVec};
|
||||
use sp_runtime::traits::ValidateUnsigned;
|
||||
|
||||
use serai_primitives::*;
|
||||
|
||||
@@ -63,8 +63,8 @@ fn set_keys_for_session(network: ExternalNetworkId) {
|
||||
ValidatorSets::set_keys(
|
||||
RawOrigin::None.into(),
|
||||
network,
|
||||
BoundedVec::new(),
|
||||
KeyPair(insecure_pair_from_name("Alice").public(), vec![].try_into().unwrap()),
|
||||
vec![].try_into().unwrap(),
|
||||
Signature([0u8; 64]),
|
||||
)
|
||||
.unwrap();
|
||||
@@ -100,7 +100,7 @@ fn set_keys_signature(set: &ExternalValidatorSet, key_pair: &KeyPair, pairs: &[P
|
||||
let sig = frost::tests::sign_without_caching(
|
||||
&mut OsRng,
|
||||
frost::tests::algorithm_machines(&mut OsRng, &Schnorrkel::new(b"substrate"), &musig_keys),
|
||||
&set_keys_message(set, &[], key_pair),
|
||||
&set_keys_message(set, key_pair),
|
||||
);
|
||||
|
||||
Signature(sig.to_bytes())
|
||||
@@ -463,16 +463,16 @@ fn set_keys_keys_exist() {
|
||||
ValidatorSets::set_keys(
|
||||
RawOrigin::None.into(),
|
||||
network,
|
||||
Vec::new().try_into().unwrap(),
|
||||
KeyPair(insecure_pair_from_name("name").public(), Vec::new().try_into().unwrap()),
|
||||
vec![].try_into().unwrap(),
|
||||
Signature([0u8; 64]),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let call = validator_sets::Call::<Test>::set_keys {
|
||||
network,
|
||||
removed_participants: Vec::new().try_into().unwrap(),
|
||||
key_pair: KeyPair(insecure_pair_from_name("name").public(), Vec::new().try_into().unwrap()),
|
||||
signature_participants: vec![].try_into().unwrap(),
|
||||
signature: Signature([0u8; 64]),
|
||||
};
|
||||
|
||||
@@ -497,8 +497,8 @@ fn set_keys_invalid_signature() {
|
||||
|
||||
let call = validator_sets::Call::<Test>::set_keys {
|
||||
network,
|
||||
removed_participants: Vec::new().try_into().unwrap(),
|
||||
key_pair: key_pair.clone(),
|
||||
signature_participants: vec![].try_into().unwrap(),
|
||||
signature,
|
||||
};
|
||||
assert_eq!(
|
||||
@@ -515,8 +515,8 @@ fn set_keys_invalid_signature() {
|
||||
|
||||
let call = validator_sets::Call::<Test>::set_keys {
|
||||
network,
|
||||
removed_participants: Vec::new().try_into().unwrap(),
|
||||
key_pair: key_pair.clone(),
|
||||
signature_participants: vec![].try_into().unwrap(),
|
||||
signature,
|
||||
};
|
||||
assert_eq!(
|
||||
@@ -534,8 +534,8 @@ fn set_keys_invalid_signature() {
|
||||
|
||||
let call = validator_sets::Call::<Test>::set_keys {
|
||||
network,
|
||||
removed_participants: Vec::new().try_into().unwrap(),
|
||||
key_pair: key_pair.clone(),
|
||||
signature_participants: vec![].try_into().unwrap(),
|
||||
signature,
|
||||
};
|
||||
assert_eq!(
|
||||
@@ -547,14 +547,11 @@ fn set_keys_invalid_signature() {
|
||||
let signature = set_keys_signature(&set, &key_pair, &participants);
|
||||
let call = validator_sets::Call::<Test>::set_keys {
|
||||
network,
|
||||
removed_participants: Vec::new().try_into().unwrap(),
|
||||
key_pair,
|
||||
signature_participants: vec![].try_into().unwrap(),
|
||||
signature,
|
||||
};
|
||||
ValidatorSets::validate_unsigned(TransactionSource::External, &call).unwrap();
|
||||
|
||||
// TODO: removed_participants parameter isn't tested since it will be removed in upcoming
|
||||
// commits?
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user