mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Misc clippy fixes
This commit is contained in:
@@ -95,10 +95,10 @@ impl scale::EncodeLike<sp_core::H256> for &BlockHash {}
|
|||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
pub use crate::{BlockNumber, BlockHash};
|
pub use crate::{BlockNumber, BlockHash};
|
||||||
pub use crate::constants::*;
|
pub use crate::constants::*;
|
||||||
pub use crate::address::*;
|
pub use crate::address::{SeraiAddress, ExternalAddress};
|
||||||
pub use crate::coin::*;
|
pub use crate::coin::*;
|
||||||
pub use crate::balance::*;
|
pub use crate::balance::*;
|
||||||
pub use crate::network_id::*;
|
pub use crate::network_id::*;
|
||||||
pub use crate::validator_sets::*;
|
pub use crate::validator_sets::{Session, ValidatorSet, ExternalValidatorSet, Slash, SlashReport};
|
||||||
pub use crate::instructions::*;
|
pub use crate::instructions::*;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,12 @@ pub struct UnbalancedMerkleTree {
|
|||||||
pub root: [u8; 32],
|
pub root: [u8; 32],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Default for UnbalancedMerkleTree {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::EMPTY
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl UnbalancedMerkleTree {
|
impl UnbalancedMerkleTree {
|
||||||
/// An empty Merkle tree.
|
/// An empty Merkle tree.
|
||||||
pub const EMPTY: Self = Self { root: [0; 32] };
|
pub const EMPTY: Self = Self { root: [0; 32] };
|
||||||
@@ -77,10 +83,17 @@ pub struct IncrementalUnbalancedMerkleTree {
|
|||||||
branches: Vec<(u64, [u8; 32])>,
|
branches: Vec<(u64, [u8; 32])>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::derivable_impls)]
|
||||||
|
impl Default for IncrementalUnbalancedMerkleTree {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self { branches: Vec::new() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl IncrementalUnbalancedMerkleTree {
|
impl IncrementalUnbalancedMerkleTree {
|
||||||
/// Create a new incrementally-created unbalanced merkle tree.
|
/// Create a new incrementally-created unbalanced merkle tree.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self { branches: Vec::new() }
|
Self::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Reduce the incremental tree.
|
/// Reduce the incremental tree.
|
||||||
|
|||||||
@@ -93,9 +93,8 @@ impl ExternalValidatorSet {
|
|||||||
|
|
||||||
// Check we have room to encode into `res`, using the approximate `size_of` for the max size of
|
// Check we have room to encode into `res`, using the approximate `size_of` for the max size of
|
||||||
// the serialization
|
// the serialization
|
||||||
const BYTES_FOR_SET: usize = 32 - (1 + DST.len());
|
|
||||||
const _ASSERT_MORE_BYTES_THAN_SIZE: [();
|
const _ASSERT_MORE_BYTES_THAN_SIZE: [();
|
||||||
BYTES_FOR_SET - core::mem::size_of::<ExternalValidatorSet>()] = [(); _];
|
32 - (1 + DST.len()) - core::mem::size_of::<ExternalValidatorSet>()] = [(); _];
|
||||||
|
|
||||||
let encoded = borsh::to_vec(&self).unwrap();
|
let encoded = borsh::to_vec(&self).unwrap();
|
||||||
res[(1 + DST.len()) .. (1 + DST.len() + encoded.len())].copy_from_slice(&encoded);
|
res[(1 + DST.len()) .. (1 + DST.len() + encoded.len())].copy_from_slice(&encoded);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ impl<S: EmbeddedEllipticCurveKeysStorage> EmbeddedEllipticCurveKeys for S {
|
|||||||
) -> bool {
|
) -> bool {
|
||||||
match network {
|
match network {
|
||||||
// Validators never need to set embedded elliptic curve keys for Serai
|
// Validators never need to set embedded elliptic curve keys for Serai
|
||||||
NetworkId::Serai => return false,
|
NetworkId::Serai => false,
|
||||||
NetworkId::External(network) => {
|
NetworkId::External(network) => {
|
||||||
!S::EmbeddedEllipticCurveKeys::contains_key(network, validator)
|
!S::EmbeddedEllipticCurveKeys::contains_key(network, validator)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ impl<T: pallet::Config> GetValidatorCount for MembershipProof<T> {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#[expect(clippy::ignored_unit_patterns, clippy::cast_possible_truncation)]
|
||||||
#[frame_support::pallet]
|
#[frame_support::pallet]
|
||||||
mod pallet {
|
mod pallet {
|
||||||
use sp_core::sr25519::Public;
|
use sp_core::sr25519::Public;
|
||||||
|
|||||||
Reference in New Issue
Block a user