Skip to content

Commit

Permalink
fix: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Supremesource committed Nov 28, 2024
1 parent 1e728ca commit 4be2d2b
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 11 deletions.
5 changes: 3 additions & 2 deletions pallets/offworker/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,9 @@ impl<T: Config> Pallet<T> {
.map(|(block_number, consensus_params)| {
let uid_weights: Vec<_> = consensus_params
.modules
.iter()
.map(|(_, module_params)| {
.values()
.map(|module_params| {
// Removed the (_, module_params) pattern
if !module_params.weight_encrypted.is_empty() {
ow_extensions::offworker::decrypt_weight(
module_params.weight_encrypted.clone(),
Expand Down
6 changes: 2 additions & 4 deletions pallets/subnet_emission/src/decryption.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use core::u32;

use crate::{
distribute_emission::update_pending_emission,
subnet_consensus::{util::params::ConsensusParams, yuma::YumaEpoch},
Expand Down Expand Up @@ -105,7 +103,7 @@ impl<T: Config> Pallet<T> {
}

/// 1. TODO: step 4. verify the zk proofs, if only one zk proof is invalid, you will ban the
/// offchain worker
/// offchain worker
///
/// 2. TODO: add a test where some of the decrypted weights will be empty, and expect everything
/// to be handeled correctly
Expand Down Expand Up @@ -329,7 +327,7 @@ impl<T: Config> Pallet<T> {
) -> Option<Vec<KeylessBlockWeights>> {
// Collect baseline weights from storage
let baseline_weights: Vec<(u16, Vec<(u16, u16)>)> =
Weights::<T>::iter_prefix(netuid).map(|(dst, weights)| (dst, weights)).collect();
Weights::<T>::iter_prefix(netuid).collect();

// Process each block's weights
let result: Vec<KeylessBlockWeights> = valid_weights
Expand Down
2 changes: 1 addition & 1 deletion pallets/subnet_emission/src/distribute_emission.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use pallet_subnet_emission_api::SubnetConsensus;
use pallet_subspace::{Pallet as PalletSubspace, N};
use subnet_consensus::yuma::YumaEpoch;

const NO_WEIGHTS: &'static str = "no weights";
const NO_WEIGHTS: &str = "no weights";

/// Processes subnets by updating pending emissions and running epochs when due.
///
Expand Down
2 changes: 1 addition & 1 deletion pallets/subnet_emission/src/set_weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ impl<T: Config> Pallet<T> {
pallet_subspace::Pallet::<T>::is_rootnet(netuid) || !uids.contains(&uid),
Error::<T>::NoSelfWeight
);
Self::check_whitelisted(netuid, &uids)?;
Self::check_whitelisted(netuid, uids)?;
Ok(())
}

Expand Down
2 changes: 1 addition & 1 deletion pallets/subspace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ pub mod pallet {
define_module_includes!(
// Put here every module-related storage map that has netuid as a key and holds a vector of values. The vector has to be indexed by the module uid.
vectors: {
Active: bool = |_: PhantomData<T>| true,
Active: bool = |_: PhantomData<T>| false,
Consensus: u64 = |_: PhantomData<T>| 0,
Emission: u64 = |_: PhantomData<T>| 0,
Incentive: u64 = |_: PhantomData<T>| 0,
Expand Down
2 changes: 1 addition & 1 deletion pallets/subspace/src/network/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl<T: Config> Pallet<T> {
)?;

// --- Delete Rate Limit ---
RootNetWeightCalls::<T>::remove(&uid);
RootNetWeightCalls::<T>::remove(uid);

// --- Delete Global-Module Storage ---
// This will remove storages if the module is only registered on this network.
Expand Down
2 changes: 1 addition & 1 deletion pallets/subspace/src/network/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ impl<T: Config> Pallet<T> {
TotalStake::<T>::mutate(|total_stake| *total_stake = total_stake.saturating_sub(amount));
}

// Decreases the stake by the amount while decreasing other counters.
/// Decreases the stake by the amount while decreasing other counters.
pub fn remove_stake_from_storage(staked: &T::AccountId) {
// Get all stakers for this staked account
let stakers: Vec<T::AccountId> =
Expand Down

0 comments on commit 4be2d2b

Please sign in to comment.