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:
@@ -51,8 +51,9 @@ hex = "0.4"
|
||||
|
||||
blake2 = "0.10"
|
||||
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group" }
|
||||
ciphersuite = { path = "../../crypto/ciphersuite" }
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group" }
|
||||
ciphersuite-kp256 = { path = "../../crypto/ciphersuite/kp256" }
|
||||
dkg-musig = { path = "../../crypto/dkg/musig" }
|
||||
frost = { package = "modular-frost", path = "../../crypto/frost", features = ["tests"] }
|
||||
schnorrkel = { path = "../../crypto/schnorrkel", package = "frost-schnorrkel" }
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
use core::{str::FromStr, fmt};
|
||||
|
||||
use scale::{Encode, Decode};
|
||||
|
||||
use dalek_ff_group::Ed25519;
|
||||
use ciphersuite::Ciphersuite;
|
||||
|
||||
|
||||
@@ -301,13 +301,13 @@ impl Serai {
|
||||
///
|
||||
/// The binding occurs at time of call. This does not track the latest finalized block and update
|
||||
/// itself.
|
||||
pub async fn as_of_latest_finalized_block(&self) -> Result<TemporalSerai, SeraiError> {
|
||||
pub async fn as_of_latest_finalized_block(&self) -> Result<TemporalSerai<'_>, SeraiError> {
|
||||
let latest = self.latest_finalized_block_hash().await?;
|
||||
Ok(TemporalSerai { serai: self, block: latest, events: RwLock::new(None) })
|
||||
}
|
||||
|
||||
/// Returns a TemporalSerai able to retrieve state as of the specified block.
|
||||
pub fn as_of(&self, block: [u8; 32]) -> TemporalSerai {
|
||||
pub fn as_of(&self, block: [u8; 32]) -> TemporalSerai<'_> {
|
||||
TemporalSerai { serai: self, block, events: RwLock::new(None) }
|
||||
}
|
||||
|
||||
@@ -424,11 +424,11 @@ impl TemporalSerai<'_> {
|
||||
SeraiValidatorSets(self)
|
||||
}
|
||||
|
||||
pub fn genesis_liquidity(&self) -> SeraiGenesisLiquidity {
|
||||
pub fn genesis_liquidity(&self) -> SeraiGenesisLiquidity<'_> {
|
||||
SeraiGenesisLiquidity(self)
|
||||
}
|
||||
|
||||
pub fn liquidity_tokens(&self) -> SeraiLiquidityTokens {
|
||||
pub fn liquidity_tokens(&self) -> SeraiLiquidityTokens<'_> {
|
||||
SeraiLiquidityTokens(self)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ async fn set_values(serai: &Serai, values: &Values) {
|
||||
frost::tests::algorithm_machines(
|
||||
&mut OsRng,
|
||||
&Schnorrkel::new(b"substrate"),
|
||||
&HashMap::from([(threshold_keys.params().i(), threshold_keys.into())]),
|
||||
&HashMap::from([(threshold_keys.params().i(), threshold_keys)]),
|
||||
),
|
||||
&oraclize_values_message(&set, values),
|
||||
);
|
||||
|
||||
@@ -55,8 +55,8 @@ pub async fn set_keys(
|
||||
}
|
||||
|
||||
let mut musig_keys = HashMap::new();
|
||||
for tk in threshold_keys {
|
||||
musig_keys.insert(tk.params().i(), tk.into());
|
||||
for threshold_keys in threshold_keys {
|
||||
musig_keys.insert(threshold_keys.params().i(), threshold_keys);
|
||||
}
|
||||
|
||||
let sig = frost::tests::sign_without_caching(
|
||||
|
||||
@@ -5,8 +5,10 @@ use zeroize::Zeroizing;
|
||||
|
||||
use ciphersuite::{
|
||||
group::{ff::Field, GroupEncoding},
|
||||
Ciphersuite, Ed25519, Secp256k1,
|
||||
Ciphersuite,
|
||||
};
|
||||
use dalek_ff_group::Ed25519;
|
||||
use ciphersuite_kp256::Secp256k1;
|
||||
|
||||
use sp_core::{
|
||||
Pair as PairTrait,
|
||||
@@ -67,7 +69,7 @@ async fn test_external_address(serai: Serai) {
|
||||
set_network_keys::<Secp256k1>(
|
||||
&serai,
|
||||
ExternalValidatorSet { session: Session(0), network },
|
||||
&[pair.clone()],
|
||||
core::slice::from_ref(&pair),
|
||||
)
|
||||
.await;
|
||||
|
||||
|
||||
@@ -1298,7 +1298,7 @@ fn cannot_block_pool_creation() {
|
||||
));
|
||||
// Then, the attacker creates 14 tokens and sends one of each to the pool account
|
||||
// skip the coin1 and coin2 coins.
|
||||
for coin in coins().into_iter().filter(|c| (*c != coin1 && *c != coin2)) {
|
||||
for coin in coins().into_iter().filter(|c| (*c != coin1) && (*c != coin2)) {
|
||||
assert_ok!(CoinsPallet::<Test>::mint(attacker, Balance { coin, amount: Amount(1000) }));
|
||||
assert_ok!(CoinsPallet::<Test>::transfer_internal(
|
||||
attacker,
|
||||
|
||||
@@ -28,6 +28,8 @@ log = "0.4"
|
||||
schnorrkel = "0.11"
|
||||
|
||||
ciphersuite = { path = "../../crypto/ciphersuite" }
|
||||
ciphersuite-kp256 = { path = "../../crypto/ciphersuite/kp256" }
|
||||
dalek-ff-group = { path = "../../crypto/dalek-ff-group" }
|
||||
embedwards25519 = { path = "../../crypto/evrf/embedwards25519" }
|
||||
secq256k1 = { path = "../../crypto/evrf/secq256k1" }
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#![allow(clippy::result_large_err)]
|
||||
|
||||
mod keystore;
|
||||
|
||||
mod chain_spec;
|
||||
|
||||
@@ -50,8 +50,10 @@ where
|
||||
{
|
||||
use substrate_frame_rpc_system::{System, SystemApiServer};
|
||||
use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};
|
||||
use ciphersuite::{Ciphersuite, Ed25519, Secp256k1};
|
||||
use bitcoin_serai::{bitcoin, crypto::x_only};
|
||||
use ciphersuite::Ciphersuite;
|
||||
use ciphersuite_kp256::{k256::elliptic_curve::point::AffineCoordinates, Secp256k1};
|
||||
use dalek_ff_group::Ed25519;
|
||||
use bitcoin_serai::bitcoin;
|
||||
|
||||
let mut module = RpcModule::new(());
|
||||
let FullDeps { id, client, pool, deny_unsafe, authority_discovery } = deps;
|
||||
@@ -128,7 +130,11 @@ where
|
||||
.map_err(|_| Error::Custom("invalid key stored in db".to_string()))?;
|
||||
|
||||
let addr = bitcoin::Address::p2tr_tweaked(
|
||||
bitcoin::key::TweakedPublicKey::dangerous_assume_tweaked(x_only(&key)),
|
||||
bitcoin::key::TweakedPublicKey::dangerous_assume_tweaked(
|
||||
bitcoin::key::XOnlyPublicKey::from_slice(key.to_affine().x().as_slice()).map_err(
|
||||
|_| Error::Custom("x-coordinate for Bitcoin key was invalid".to_string()),
|
||||
)?,
|
||||
),
|
||||
bitcoin::address::KnownHrp::Mainnet,
|
||||
);
|
||||
|
||||
|
||||
@@ -49,7 +49,9 @@ pallet-timestamp = { git = "https://github.com/serai-dex/substrate", default-fea
|
||||
|
||||
sp-consensus-babe = { git = "https://github.com/serai-dex/substrate", default-features = false }
|
||||
|
||||
ciphersuite = { path = "../../../crypto/ciphersuite", 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-musig = { path = "../../../crypto/dkg/musig", default-features = false, features = ["std"] }
|
||||
frost = { package = "modular-frost", path = "../../../crypto/frost", features = ["tests"] }
|
||||
schnorrkel = { path = "../../../crypto/schnorrkel", package = "frost-schnorrkel" }
|
||||
|
||||
|
||||
@@ -2,8 +2,9 @@ use crate::{mock::*, primitives::*};
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use ciphersuite::{Ciphersuite, Ristretto};
|
||||
use frost::dkg::musig::musig;
|
||||
use ciphersuite::Ciphersuite;
|
||||
use dalek_ff_group::Ristretto;
|
||||
use dkg_musig::musig;
|
||||
use schnorrkel::Schnorrkel;
|
||||
|
||||
use zeroize::Zeroizing;
|
||||
@@ -87,14 +88,14 @@ fn set_keys_signature(set: &ExternalValidatorSet, key_pair: &KeyPair, pairs: &[P
|
||||
assert_eq!(Ristretto::generator() * secret_key, pub_keys[i]);
|
||||
|
||||
threshold_keys.push(
|
||||
musig::<Ristretto>(&musig_context((*set).into()), &Zeroizing::new(secret_key), &pub_keys)
|
||||
musig::<Ristretto>(musig_context((*set).into()), Zeroizing::new(secret_key), &pub_keys)
|
||||
.unwrap(),
|
||||
);
|
||||
}
|
||||
|
||||
let mut musig_keys = HashMap::new();
|
||||
for tk in threshold_keys {
|
||||
musig_keys.insert(tk.params().i(), tk.into());
|
||||
for threshold_keys in threshold_keys {
|
||||
musig_keys.insert(threshold_keys.params().i(), threshold_keys);
|
||||
}
|
||||
|
||||
let sig = frost::tests::sign_without_caching(
|
||||
|
||||
Reference in New Issue
Block a user