mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Fix clippy, update old dependencies
This commit is contained in:
@@ -29,7 +29,7 @@ transcript = { package = "flexible-transcript", path = "../crypto/transcript", d
|
||||
dalek-ff-group = { path = "../crypto/dalek-ff-group", default-features = false, features = ["std"] }
|
||||
ciphersuite = { path = "../crypto/ciphersuite", default-features = false, features = ["std"] }
|
||||
schnorr = { package = "schnorr-signatures", path = "../crypto/schnorr", default-features = false, features = ["std", "aggregate"] }
|
||||
dkg-musig = { path = "../crypto/dkg/musig", default-features = false, features = ["std"] }
|
||||
dkg = { package = "dkg-musig", path = "../crypto/dkg/musig", default-features = false, features = ["std"] }
|
||||
frost = { package = "modular-frost", path = "../crypto/frost" }
|
||||
frost-schnorrkel = { path = "../crypto/schnorrkel" }
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ impl<D: Db> ContinuallyRan for CosignIntendTask<D> {
|
||||
|
||||
// Tell each set of their expectation to cosign this block
|
||||
for set in global_session_info.sets {
|
||||
log::debug!("{:?} will be cosigning block #{block_number}", set);
|
||||
log::debug!("{set:?} will be cosigning block #{block_number}");
|
||||
IntendedCosigns::send(
|
||||
&mut txn,
|
||||
set,
|
||||
|
||||
@@ -3,13 +3,11 @@ use std::{boxed::Box, collections::HashMap};
|
||||
|
||||
use zeroize::Zeroizing;
|
||||
use rand_core::OsRng;
|
||||
use ciphersuite::{group::GroupEncoding, Ciphersuite, Ristretto};
|
||||
use ciphersuite::{group::GroupEncoding, Ciphersuite};
|
||||
use dalek_ff_group::Ristretto;
|
||||
use dkg::{Participant, musig};
|
||||
use frost_schnorrkel::{
|
||||
frost::{
|
||||
dkg::{Participant, musig::musig},
|
||||
FrostError,
|
||||
sign::*,
|
||||
},
|
||||
frost::{FrostError, sign::*},
|
||||
Schnorrkel,
|
||||
};
|
||||
|
||||
@@ -155,16 +153,15 @@ impl<CD: DbTrait, TD: DbTrait> ConfirmDkgTask<CD, TD> {
|
||||
db: &mut CD,
|
||||
set: ExternalValidatorSet,
|
||||
attempt: u32,
|
||||
key: &Zeroizing<<Ristretto as Ciphersuite>::F>,
|
||||
key: Zeroizing<<Ristretto as Ciphersuite>::F>,
|
||||
signer: &mut Option<Signer>,
|
||||
) {
|
||||
// Perform the preprocess
|
||||
let public_key = Ristretto::generator() * key.deref();
|
||||
let (machine, preprocess) = AlgorithmMachine::new(
|
||||
schnorrkel(),
|
||||
// We use a 1-of-1 Musig here as we don't know who will actually be in this Musig yet
|
||||
musig(&musig_context(set.into()), key, &[Ristretto::generator() * key.deref()])
|
||||
.unwrap()
|
||||
.into(),
|
||||
musig(musig_context(set.into()), key, &[public_key]).unwrap(),
|
||||
)
|
||||
.preprocess(&mut OsRng);
|
||||
// We take the preprocess so we can use it in a distinct machine with the actual Musig
|
||||
@@ -199,7 +196,7 @@ impl<CD: DbTrait, TD: DbTrait> ContinuallyRan for ConfirmDkgTask<CD, TD> {
|
||||
// If we were sent a key to set, create the signer for it
|
||||
if self.signer.is_none() && KeysToConfirm::get(&self.db, self.set.set).is_some() {
|
||||
// Create and publish the initial preprocess
|
||||
Self::preprocess(&mut self.db, self.set.set, 0, &self.key, &mut self.signer);
|
||||
Self::preprocess(&mut self.db, self.set.set, 0, self.key.clone(), &mut self.signer);
|
||||
|
||||
made_progress = true;
|
||||
}
|
||||
@@ -219,7 +216,13 @@ impl<CD: DbTrait, TD: DbTrait> ContinuallyRan for ConfirmDkgTask<CD, TD> {
|
||||
id: messages::sign::SignId { attempt, .. },
|
||||
} => {
|
||||
// Create and publish the preprocess for the specified attempt
|
||||
Self::preprocess(&mut self.db, self.set.set, attempt, &self.key, &mut self.signer);
|
||||
Self::preprocess(
|
||||
&mut self.db,
|
||||
self.set.set,
|
||||
attempt,
|
||||
self.key.clone(),
|
||||
&mut self.signer,
|
||||
);
|
||||
}
|
||||
messages::sign::CoordinatorMessage::Preprocesses {
|
||||
id: messages::sign::SignId { attempt, .. },
|
||||
@@ -258,9 +261,9 @@ impl<CD: DbTrait, TD: DbTrait> ContinuallyRan for ConfirmDkgTask<CD, TD> {
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let keys = musig(&musig_context(self.set.set.into()), &self.key, &musig_public_keys)
|
||||
.unwrap()
|
||||
.into();
|
||||
let keys =
|
||||
musig(musig_context(self.set.set.into()), self.key.clone(), &musig_public_keys)
|
||||
.unwrap();
|
||||
|
||||
// Rebuild the machine
|
||||
let (machine, preprocess_from_cache) =
|
||||
|
||||
@@ -6,10 +6,7 @@ use rand_core::{RngCore, OsRng};
|
||||
|
||||
use dalek_ff_group::Ristretto;
|
||||
use ciphersuite::{
|
||||
group::{
|
||||
ff::{Field, PrimeField},
|
||||
GroupEncoding,
|
||||
},
|
||||
group::{ff::PrimeField, GroupEncoding},
|
||||
Ciphersuite,
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@ use std::sync::Arc;
|
||||
|
||||
use zeroize::Zeroizing;
|
||||
|
||||
use ciphersuite::{Ciphersuite, Ristretto};
|
||||
use ciphersuite::Ciphersuite;
|
||||
use dalek_ff_group::Ristretto;
|
||||
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@ use std::sync::Arc;
|
||||
use zeroize::Zeroizing;
|
||||
use rand_core::OsRng;
|
||||
use blake2::{digest::typenum::U32, Digest, Blake2s};
|
||||
use ciphersuite::{Ciphersuite, Ristretto};
|
||||
use ciphersuite::Ciphersuite;
|
||||
use dalek_ff_group::Ristretto;
|
||||
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
@@ -67,9 +68,7 @@ async fn provide_transaction<TD: DbTrait, P: P2p>(
|
||||
// advancing
|
||||
Err(ProvidedError::LocalMismatchesOnChain) => loop {
|
||||
log::error!(
|
||||
"Tributary {:?} was supposed to provide {:?} but peers disagree, halting Tributary",
|
||||
set,
|
||||
tx,
|
||||
"Tributary {set:?} was supposed to provide {tx:?} but peers disagree, halting Tributary",
|
||||
);
|
||||
// Print this every five minutes as this does need to be handled
|
||||
tokio::time::sleep(Duration::from_secs(5 * 60)).await;
|
||||
|
||||
@@ -27,7 +27,8 @@ rand_chacha = { version = "0.3", default-features = false, features = ["std"] }
|
||||
blake2 = { version = "0.10", default-features = false, features = ["std"] }
|
||||
transcript = { package = "flexible-transcript", path = "../../crypto/transcript", version = "0.3", default-features = false, features = ["std", "recommended"] }
|
||||
|
||||
ciphersuite = { package = "ciphersuite", path = "../../crypto/ciphersuite", version = "0.4", default-features = false, features = ["std"] }
|
||||
ciphersuite = { path = "../../crypto/ciphersuite", version = "0.4", default-features = false, features = ["std"] }
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["std"] }
|
||||
schnorr = { package = "schnorr-signatures", path = "../../crypto/schnorr", version = "0.5", default-features = false, features = ["std", "aggregate"] }
|
||||
|
||||
hex = { version = "0.4", default-features = false, features = ["std"] }
|
||||
|
||||
@@ -3,7 +3,8 @@ use std::{sync::Arc, io};
|
||||
|
||||
use zeroize::Zeroizing;
|
||||
|
||||
use ciphersuite::{Ciphersuite, Ristretto};
|
||||
use ciphersuite::Ciphersuite;
|
||||
use dalek_ff_group::Ristretto;
|
||||
|
||||
use scale::Decode;
|
||||
use futures_channel::mpsc::UnboundedReceiver;
|
||||
|
||||
@@ -9,7 +9,6 @@ use rand_chacha::ChaCha12Rng;
|
||||
|
||||
use transcript::{Transcript, RecommendedTranscript};
|
||||
|
||||
use dalek_ff_group::Ristretto;
|
||||
use ciphersuite::{
|
||||
group::{
|
||||
GroupEncoding,
|
||||
@@ -17,6 +16,7 @@ use ciphersuite::{
|
||||
},
|
||||
Ciphersuite,
|
||||
};
|
||||
use dalek_ff_group::Ristretto;
|
||||
use schnorr::{
|
||||
SchnorrSignature,
|
||||
aggregate::{SchnorrAggregator, SchnorrAggregate},
|
||||
@@ -164,7 +164,6 @@ impl SignatureScheme for Validators {
|
||||
type AggregateSignature = Vec<u8>;
|
||||
type Signer = Arc<Signer>;
|
||||
|
||||
#[must_use]
|
||||
fn verify(&self, validator: Self::ValidatorId, msg: &[u8], sig: &Self::Signature) -> bool {
|
||||
if !self.weights.contains_key(&validator) {
|
||||
return false;
|
||||
@@ -197,7 +196,6 @@ impl SignatureScheme for Validators {
|
||||
aggregate.serialize()
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
fn verify_aggregate(
|
||||
&self,
|
||||
signers: &[Self::ValidatorId],
|
||||
|
||||
@@ -8,8 +8,9 @@ use blake2::{Digest, Blake2b512};
|
||||
|
||||
use ciphersuite::{
|
||||
group::{Group, GroupEncoding},
|
||||
Ciphersuite, Ristretto,
|
||||
Ciphersuite,
|
||||
};
|
||||
use dalek_ff_group::Ristretto;
|
||||
use schnorr::SchnorrSignature;
|
||||
|
||||
use crate::{TRANSACTION_SIZE_LIMIT, ReadWrite};
|
||||
|
||||
@@ -114,7 +114,6 @@ impl<S: SignatureScheme> SignatureScheme for Arc<S> {
|
||||
self.as_ref().aggregate(validators, msg, sigs)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
fn verify_aggregate(
|
||||
&self,
|
||||
signers: &[Self::ValidatorId],
|
||||
|
||||
@@ -46,7 +46,6 @@ impl SignatureScheme for TestSignatureScheme {
|
||||
type AggregateSignature = Vec<[u8; 32]>;
|
||||
type Signer = TestSigner;
|
||||
|
||||
#[must_use]
|
||||
fn verify(&self, validator: u16, msg: &[u8], sig: &[u8; 32]) -> bool {
|
||||
(sig[.. 2] == validator.to_le_bytes()) && (sig[2 ..] == [msg, &[0; 30]].concat()[.. 30])
|
||||
}
|
||||
@@ -60,7 +59,6 @@ impl SignatureScheme for TestSignatureScheme {
|
||||
sigs.to_vec()
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
fn verify_aggregate(
|
||||
&self,
|
||||
signers: &[TestValidatorId],
|
||||
|
||||
@@ -26,6 +26,7 @@ borsh = { version = "1", default-features = false, features = ["std", "derive",
|
||||
|
||||
blake2 = { version = "0.10", default-features = false, features = ["std"] }
|
||||
ciphersuite = { path = "../../crypto/ciphersuite", default-features = false, features = ["std"] }
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group", default-features = false, features = ["std"] }
|
||||
dkg = { path = "../../crypto/dkg", default-features = false, features = ["std"] }
|
||||
schnorr = { package = "schnorr-signatures", path = "../../crypto/schnorr", default-features = false, features = ["std"] }
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ impl<TD: Db, TDT: DbTxn, P: P2p> ScanBlock<'_, TD, TDT, P> {
|
||||
let signer = signer(signed);
|
||||
|
||||
// Check the participant voted to be removed actually exists
|
||||
if !self.validators.iter().any(|validator| *validator == participant) {
|
||||
if !self.validators.contains(&participant) {
|
||||
TributaryDb::fatal_slash(
|
||||
self.tributary_txn,
|
||||
self.set.set,
|
||||
|
||||
@@ -5,11 +5,11 @@ use zeroize::Zeroizing;
|
||||
use rand_core::{RngCore, CryptoRng};
|
||||
|
||||
use blake2::{digest::typenum::U32, Digest, Blake2b};
|
||||
use dalek_ff_group::Ristretto;
|
||||
use ciphersuite::{
|
||||
group::{Group, GroupEncoding},
|
||||
group::{ff::Field, Group, GroupEncoding},
|
||||
Ciphersuite,
|
||||
};
|
||||
use dalek_ff_group::Ristretto;
|
||||
use schnorr::SchnorrSignature;
|
||||
|
||||
use scale::Encode;
|
||||
|
||||
Reference in New Issue
Block a user